import re


def to_snake_case(string):
    """Converts string to snake_case

    we don't use title because that forces lowercase for the word, whereas we want:
    PSK -> psk
    api key -> api_key
    content-length -> content_length
    user -> user
    """
    return re.sub("[ -]", "_", string).lower()