code: def validate_userid_signature(user: User) -> Optional[Address]:
      
      # display_name should be an address in the USERID_RE format
      match = USERID_RE.match(user.user_id)
      if not match:
          return None
  
      encoded_address = match.group(1)
      address: Address = to_canonical_address(encoded_address)
  
      try:
          displayname = user.get_display_name()
          recovered = recover(
              data=user.user_id.encode(),
              signature=decode_hex(displayname),
          )
          if not (address and recovered and recovered == address):
              return None
      except (
              DecodeError,
              TypeError,
              InvalidSignature,
              MatrixRequestError,
              json.decoder.JSONDecodeError,
      ):
          return None
      return address
docs: Validate a userId format and signature on displayName, and return its address