import ast


def matches_namespace(node, namespace):
    """Determines if the ``ast.Call`` node corresponds to a matching namespace.

    Args:
        node (ast.Call): a node that represents a function call. For more,
            see https://docs.python.org/3/library/ast.html#abstract-grammar.
        namespace (str): the namespace.

    Returns:
        bool: if the node's namespaces matches the given namespace.
    """
    names = namespace.split(".")
    name, value = names.pop(), node.func.value
    while isinstance(value, ast.Attribute) and len(names) > 0:
        if value.attr != name:
            return False
        name, value = names.pop(), value.value

    return isinstance(value, ast.Name) and value.id == name