code: def xmlns(source):
      
      namespaces = {}
      events=("end", "start-ns", "end-ns")
      for (event, elem) in iterparse(source, events):
          if event == "start-ns":
              prefix, ns = elem
              namespaces[prefix] = ns
          elif event == "end":
              break
  
      # Reset stream
      if hasattr(source, "seek"):
          source.seek(0)
  
      return namespaces
docs: Returns a map of prefix to namespace for the given XML file.