def str_to_filename(s):
    """Replaces spaces, (double and single) quotes
    and double underscores to underscores
    """
    s = s.replace(' ', '_').replace('"', '_').replace("'", '_').replace('.',
        '_')
    while '__' in s:
        s = s.replace('__', '_')
    return s
