import re


def cache_key(query):
    """Make filesystem-friendly cache key"""
    key = query
    key = key.lower()
    key = re.sub(r"[^a-z0-9-_;.]", "-", key)
    key = re.sub(r"-+", "-", key)
    return key