def get_target_namespace(xsd_tree, namespaces):
    """Returns the target namespace used in the schema

    Args:
        xsd_tree:
        namespaces:

    Returns:

    """
    root_attributes = xsd_tree.getroot().attrib
    target_namespace = root_attributes['targetNamespace'
        ] if 'targetNamespace' in root_attributes else None
    target_namespace_prefix = ''
    if target_namespace is not None:
        for prefix, url in list(namespaces.items()):
            if url == target_namespace:
                target_namespace_prefix = prefix
                break
    return target_namespace, target_namespace_prefix
