import re


def clean(string):
    """Clean string

    Cleans a string to be a valid Python variable name.
    It replaces all invalid characters with an underscore.

    Arguments:
        string {str} -- string to be formatted

    Returns:
        str -- formatted string
    """
    string = re.sub('\W|^(?=\d)', '_', string).lower()
    return string