'Properly determine the message length for this request. It will return
an integer if the headers explicitly contain the message length, or
None if the headers don\'t contain a length. The ValueError exception
will be raised if the headers are invalid.
:raises ValueError: if either transfer-encoding or content-length
headers have bad values
:raises AttributeError: if the last value of the transfer-encoding
header is not "chunked"'

def message_length(self):

    if (not is_chunked(self.headers)):
        fsize = self.headers.get('content-length', None)
        if (fsize is not None):
            try:
                fsize = int(fsize)
            except ValueError:
                raise ValueError('Invalid    Content-Length    header    value')
    else:
        fsize = None
    return fsize
