import re


def camel_to_underscore(camel_str):
    """Convert a camelCase string to underscore_notation.

    This is useful for converting JSON style variable names
    to python style variable names.
    """
    return re.sub('([a-z0-9])([A-Z])', r'\1_\2', camel_str).lower()