def as_key(key):
    """Strips any / prefix and/or suffix from a supplied key (path) string.

    Most uses of the asset path as a key (other than validation by
    is_path_allowed) expect any leading and trailing / URL path
    separators have been removed.
    """
    return key.lstrip('/').rstrip('/')