def METHOD_NAME(fd, timeout=None):
    if timeout is None:
        msg = ''
        nargs = 1000
        idx = -1
        while idx <= (nargs-1):
            header, numbytes, nargs, idx = getheader(fd)
            msg = msg+header+getbytes(fd, numbytes)
    else:
        s = select.select([fd], [], [], timeout)
        if fd in s[0]:
            header, numbytes, nargs, idx = getheader(fd)
            msg = header+getbytes(fd, numbytes)
        else:
            raise Exception('Getmsg timeout')
    return msg