code: def attribute_requirement(self, entity_id, index=None):
          
          res = {"required": [], "optional": []}
  
          try:
              for sp in self[entity_id]["spsso_descriptor"]:
                  _res = attribute_requirement(sp, index)
                  res["required"].extend(_res["required"])
                  res["optional"].extend(_res["optional"])
          except KeyError:
              return None
  
          return res
docs: Returns what attributes the SP requires and which are optional
          if any such demands are registered in the Metadata.
  
          :param entity_id: The entity id of the SP
          :param index: which of the attribute consumer services its all about
              if index=None then return all attributes expected by all
              attribute_consuming_services.
          :return: 2-tuple, list of required and list of optional attributes