def METHOD_NAME(self, expected: bytes, timeout: float = None) -> bytes:
    actual = self.read(len(expected), timeout=timeout)
    actual += self.read_all()
    assert expected == actual, "Expected %r, got %r" % (expected, actual)
    return actual