def get_namespaces(parent):
    """parse the first element of a datastream xml tree for namespaces"""
    namespace = {}
    for child in parent.get_elements():
        for attrib_name in child._attributes:
            if 'xmlns:' in attrib_name:
                namespace[attrib_name[6:]] = child[attrib_name]
    print(namespace)
    return namespace
