import string


def _clean_string(s):
    """Clean up a string.

    Specifically, cleaning up a string entails
    1. making it lowercase,
    2. replacing spaces with underscores, and
    3. removing any characters that are not lowercase letters, numbers, or
       underscores.

    Parameters
    ----------
    s: str
        String to clean up.

    Returns
    -------
    str:
        Cleaned up string according to above definition.
    """
    valid = string.ascii_lowercase + string.digits + '_'
    s_nospace = s.lower().replace(' ', '_')
    s_clean = ''.join(char for char in s_nospace if char in valid)
    return s_clean