code: def author_id_normalize_and_schema(uid, schema=None):
      def _get_uid_normalized_in_schema(_uid, _schema):
          regex, template = _RE_AUTHORS_UID[_schema]
          match = regex.match(_uid)
          if match:
              return template.format(match.group('uid'))
      if idutils.is_orcid(uid) and schema in (None, 'ORCID'):
          return idutils.normalize_orcid(uid), 'ORCID'
      if schema and schema not in _RE_AUTHORS_UID:
          raise UnknownUIDSchema(uid)
      if schema:
          normalized_uid = _get_uid_normalized_in_schema(uid, schema)
          if normalized_uid:
              return normalized_uid, schema
          else:
              raise SchemaUIDConflict(schema, uid)
      match_schema, normalized_uid = None, None
      for candidate_schema in _RE_AUTHORS_UID:
          candidate_uid = _get_uid_normalized_in_schema(uid, candidate_schema)
          if candidate_uid:
              if match_schema:
                  raise UnknownUIDSchema(uid)
              match_schema = candidate_schema
              normalized_uid = candidate_uid
      if match_schema:
          return normalized_uid, match_schema
      raise UnknownUIDSchema(uid)