def recv_some(p, t=.1, e=1, tr=5, stderr=0):
    if tr < 1:
        tr = 1
    x = time.time()+t
    y = []
    r = ''
    pr = p.recv
    if stderr:
        pr = p.recv_err
    while time.time() < x or r:
        r = pr()
        if r is None:
            if e:
                raise Exception(disconnect_message)
            else:
                break
        elif r:
            y.append(r)
        else:
            time.sleep(max((time.time()-x)/tr, 0))
    return ''.join(y)

# TODO(3.0:  rewrite to use memoryview()
dataset/ETHPy150Open adblockplus/gyp/test/lib/TestCmd.py/recv_some/swapped operands of `-`