code: def service(self, entity_id, typ, service, binding=None):
          
          try:
              srvs = []
              for t in self[entity_id][typ]:
                  try:
                      srvs.extend(t[service])
                  except KeyError:
                      pass
          except KeyError:
              return None
  
          if not srvs:
              return srvs
  
          if binding:
              res = []
              for srv in srvs:
                  if srv["binding"] == binding:
                      res.append(srv)
          else:
              res = {}
              for srv in srvs:
                  try:
                      res[srv["binding"]].append(srv)
                  except KeyError:
                      res[srv["binding"]] = [srv]
          logger.debug("service => %s", res)
          return res
docs: Get me all services with a specified
          entity ID and type, that supports the specified version of binding.
  
          :param entity_id: The EntityId
          :param typ: Type of service (idp, attribute_authority, ...)
          :param service: which service that is sought for
          :param binding: A binding identifier
          :return: list of service descriptions.
              Or if no binding was specified a list of 2-tuples (binding, srv)