code: def create_signed_entities_descriptor(entity_descriptors, security_context, valid_for=None):
      
      entities_desc, xmldoc = entities_descriptor(entity_descriptors, valid_for=valid_for, name=None, ident=None,
                                                  sign=True, secc=security_context)
      if not valid_instance(entities_desc):
          raise ValueError("Could not construct valid EntitiesDescriptor tag")
  
      return xmldoc
docs: :param entity_descriptors: the entity descriptors to put in in an EntitiesDescriptor tag and sign
      :param security_context: security context for the signature
      :param valid_for: number of hours the metadata should be valid
      :return: the signed XML document
  
      :type entity_descriptors: Sequence[saml2.md.EntityDescriptor]]
      :type security_context: saml2.sigver.SecurityContext
      :type valid_for: Optional[int]