def get_metadata_namespaces(metadata):
    """
    Utility function to get all the namespaces from a metadata document and return them as a set()
    :param metadata: the metadata document
    :type metadata: schema.Edmx
    :return: the namespace
    """
    metadata_namespaces = set()
    for reference in metadata.References:
        for include in reference.Includes:
            metadata_namespaces.add(include.Namespace)
    return metadata_namespaces