>>> normalize_path("/a/b/c/")
    '/a/b/c'
    >>> normalize_path("/a/b/c")
    '/a/b/c'
    >>> normalize_path("/a/b/c////////")
    '/a/b/c'
    >>> normalize_path("///a/b/c")
    '/a/b/c'
    >>> normalize_path("/a/././b/../b/c/")
    '/a/b/c'
    >>> normalize_path(":memory:")
    ':memory:'

def normalize_path(path):
    """
    >>> normalize_path("/a/b/c/")
    '/a/b/c'
    >>> normalize_path("/a/b/c")
    '/a/b/c'
    >>> normalize_path("/a/b/c////////")
    '/a/b/c'
    >>> normalize_path("///a/b/c")
    '/a/b/c'
    >>> normalize_path("/a/././b/../b/c/")
    '/a/b/c'
    >>> normalize_path(":memory:")
    ':memory:'
    """
    if path == ":memory:":
        return path

    return os.path.normcase(os.path.normpath(os.path.realpath(path)))