def get_length(key_list):
    """
    Get length in the TLV
    :param key_list: Key to parse
    :return: Length in the TLV
    """
    # Find tag value
    if 2 == int(key_list[0], 16):  # pylint: disable=misplaced-comparison-constant
        # check MSB is zero, if yes then this byte indicates length
        # else this byte indicates number of bytes for length calculation
        if int(key_list[1], 16) & 0x80 == 0x00:
            length = int(key_list[1], 16)
            length += 2
        else:
            length_bytes = int(key_list[1], 16) & 0x7f  # Mask MSB
            length_header = 2 + length_bytes
            length = int(key_list[2], 16)
            for i in range(1, length_bytes):
                length = length * 0x100
                length = length | int(key_list[2 + i], 16)
            length += length_header
        return length
    return 0