@staticmethod<EOL><INDENT>def builder(sp, authnsign=False, wsign=False, valid_until=None, cache_duration=None, contacts=None, organization=None):<DEDENT>
if valid_until is None:<EOL><INDENT>valid_until = int(time()) + OneLogin_Saml2_Metadata.TIME_VALID<EOL><DEDENT>if not isinstance(valid_until, basestring):<EOL><INDENT>if isinstance(valid_until, datetime):<EOL><INDENT>valid_until_time = valid_until.timetuple()<EOL><DEDENT>else:<EOL><INDENT>valid_until_time = gmtime(valid_until)<EOL><DEDENT>valid_until_str = strftime(r'<STR_LIT>', valid_until_time)<EOL><DEDENT>else:<EOL><INDENT>valid_until_str = valid_until<EOL><DEDENT>if cache_duration is None:<EOL><INDENT>cache_duration = OneLogin_Saml2_Metadata.TIME_CACHED<EOL><DEDENT>if not isinstance(cache_duration, basestring):<EOL><INDENT>cache_duration_str = '<STR_LIT>' % cache_duration  <EOL><DEDENT>else:<EOL><INDENT>cache_duration_str = cache_duration<EOL><DEDENT>if contacts is None:<EOL><INDENT>contacts = {}<EOL><DEDENT>if organization is None:<EOL><INDENT>organization = {}<EOL><DEDENT>str_attribute_consuming_service = '<STR_LIT>'<EOL>if '<STR_LIT>' in sp and len(sp['<STR_LIT>']):<EOL><INDENT>attr_cs_desc_str = '<STR_LIT>'<EOL>if "<STR_LIT>" in sp['<STR_LIT>']:<EOL><INDENT>attr_cs_desc_str = """<STR_LIT>"""<EOL><saml:AttributeValue xmlns:saml="<STR_LIT>">%(attributeValue)s</saml:AttributeValue>"""<STR_LIT>"""<EOL><DEDENT></md:RequestedAttribute>"""<STR_LIT>"""            <md:RequestedAttribute Name="<STR_LIT>"%(req_attr_nameformat_str)s%(req_attr_friendlyname_str)s%(req_attr_isrequired_str)s%(req_attr_aux_str)s"""<STR_LIT>"""        <md:AttributeConsumingService index="<STR_LIT:1>"><EOL><md:ServiceName xml:lang="<STR_LIT>">%(service_name)s</md:ServiceName><EOL><DEDENT>s_desc)s%(requested_attribute_str)s<EOL></md:AttributeConsumingService><EOL>{<EOL><INDENT>'<STR_LIT>': sp['<STR_LIT>']['<STR_LIT>'],<EOL>'<STR_LIT>': attr_cs_desc_str,<EOL>'<STR_LIT>': '<STR_LIT:\n>'.join(requested_attribute_data)<EOL>
Builds the metadata of the SP

:param sp: The SP data
:type sp: string

:param authnsign: authnRequestsSigned attribute
:type authnsign: string

:param wsign: wantAssertionsSigned attribute
:type wsign: string

:param valid_until: Metadata's expiry date
:type valid_until: string|DateTime|Timestamp

:param cache_duration: Duration of the cache in seconds
:type cache_duration: int|string

:param contacts: Contacts info
:type contacts: dict

:param organization: Organization info
:type organization: dict