CLN: localising scope of functions in `Styler`
- [x] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them

`Styler` has a mixture of function placements, e.g. outer scope, or as class methods or inner scope of class methods.

This PR has moved two outer scope functions to inner scope of class methods, where they are only used / relevant for that section, to be more consistent with the rest of the class.


i would rather go the other way. slimming the logic in the class and pulling out function to the module level scope. @jreback ok, ill close this and if I get a chance submit PRs that try to do that instead.