def as_base(path):
    """Prefixes and suffixes the provided path string with / if not present.

    "Base" paths, with their leading and trailing / URL path separators, are
    used when deciding if an asset path (also known as an asset 'key') is
    allowed for uploading, to prevent partial matches like 'views_of_space'
    matching because it has a prefix of 'views'. The base '/views/' path is
    protected from matching a corresponding base '/views_of_space/' path.
    """
    path = path if path.startswith('/') else '/' + path
    return  path if path.endswith('/') else path + '/'