code: def parse_SAML_to_time(timestr):
          r
          try:
              data = datetime.strptime(timestr, '%Y-%m-%dT%H:%M:%SZ')
          except ValueError:
              data = datetime.strptime(timestr, '%Y-%m-%dT%H:%M:%S.%fZ')
          return calendar.timegm(data.utctimetuple())
docs: r"""
          Converts a SAML2 timestamp on the form yyyy-mm-ddThh:mm:ss(\.s+)?Z
          to a UNIX timestamp. The sub-second part is ignored.
  
          :param timestr: The time we should convert (SAML Timestamp).
          :type: string
  
          :return: Converted to a unix timestamp.
          :rtype: int