<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def read_serialized_rsa_pub_key(serialized):
 """ Reads serialized RSA pub key TAG|len-2B|value. 81 = exponent, 82 = modulus :param serialized: :return: n, e """

        n = None
        e = None
        rsa = from_hex(serialized)

        pos = 0
        ln = len(rsa)
        while pos < ln:
            tag = bytes_to_byte(rsa, pos)
            pos += 1
            length = bytes_to_short(rsa, pos)
            pos += 2

            if tag == 0x81:
                e = bytes_to_long(rsa[pos:pos+length])
            elif tag == 0x82:
                n = bytes_to_long(rsa[pos:pos+length])

            pos += length

        if e is None or n is None:
            logger.warning("Could not process import key")
            raise ValueError('Public key deserialization failed')

        return n, e