Please clarify on this docstring what this function does. And add descriptions about the parameters as well.