Converts to lowercase, removes non-alpha characters,
    and converts spaces to hyphens.

def string_to_basename(s):
    '''
    Converts to lowercase, removes non-alpha characters,
    and converts spaces to hyphens.
    '''
    s = s.strip().lower()
    s = re.sub(r'[^\w\s-]', '', s)
    return re.sub(r'[\s-]+', '-', s)