def determineLength(length):
        """
        Given first read byte, determine how many more bytes
        needs to be known in order to get fully encoded length.

        :param length: First read byte.
        :return: How many bytes to read.
        """
        integer = ord(length)

        if integer < 128:
            return 0
        elif integer < 192:
            return 1
        elif integer < 224:
            return 2
        elif integer < 240:
            return 3
        else:
            raise ConnectionError('Unknown controll byte {}'.format(length))
def determineLength ( length ) : integer = ord ( length ) if integer < 128 : return 0 elif integer < 192 : return 1 elif integer < 224 : return 2 elif integer < 240 : return 3 else : raise ConnectionError ( 'Unknown controll byte {}' . format ( length ) )
Given first read byte, determine how many more bytes
        needs to be known in order to get fully encoded length.

        :param length: First read byte.
        :return: How many bytes to read.