def string_to_identifier(s, white_space_becomes='_'):
    """ Takes a string and makes it suitable for use as an identifier

        Translates to lower case
        Replaces white space by the white_space_becomes character (default=underscore).
        Removes and punctuation.
    """
    import re
    s = s.lower()
    s = re.sub('\\s+', white_space_becomes, s)
    s = re.sub('-', '_', s)
    s = re.sub('[^A-Za-z0-9_]', '', s)
    return s
