A practical implementation of weighted kernel density estimation for handling shape constraints