def find_magic_number(data, magic_number):
    """ attempts to find a magic number in a stream of bytes
    returns the start position where the magic number was found
    or None if not found
    """
    base = data.tell()
    while True:
        chunk = data.read(len(magic_number))
        if not chunk or len(chunk) != len(magic_number):
            return None
        if chunk == magic_number:
            return base
        base += 1
        data.seek(base)
