'Search some bytes in [start_address;end_address[. Addresses must
be aligned to byte. Returns the address of the bytes if found,
None else.'

def searchBytes(self, needle, start_address=0, end_address=None):

    if (start_address % 8):
        raise InputStreamError('Unable    to    search    bytes    with    address    with    bit    granularity')
    length = len(needle)
    size = max((3 * length), 4096)
    buffer = ''
    if (self._size and ((end_address is None) or (self._size < end_address))):
        end_address = self._size
    while True:
        if (end_address is not None):
            todo = ((end_address - start_address) >> 3)
            if (todo < size):
                if (todo <= 0):
                    return None
                size = todo
        data = self.readBytes(start_address, size)
        if ((end_address is None) and self._size):
            end_address = self._size
            size = ((end_address - start_address) >> 3)
            assert (size > 0)
            data = data[:size]
        start_address += (8 * size)
        buffer = (buffer[((len(buffer) - length) + 1):] + data)
        found = buffer.find(needle)
        if (found >= 0):
            return (start_address + ((found - len(buffer)) * 8))
