def normalize_path(path):
    """Put a URL path into the format used by the data structure."""

    if path in ('', '/'):
        return '/'

    path = path.rstrip('/')
    if not path.startswith('/'):
        path = '/{path}'.format(path=path)
    return path