def METHOD_NAME(self, file: File, start_offset: int) -> Optional[ValidChunk]:
    if not _validate_stream_header(file):
        raise InvalidInputFormat("Invalid bzip2 stream header")
    if not _validate_block_header(file):
        raise InvalidInputFormat("Invalid bzip2 block header")
    context = Bzip2SearchContext(
        start_offset=start_offset, file=file, end_block_offset=-1
    )
    try:
        scanner = hyperscan_stream_end_magic_db.build(context, _hyperscan_match)
        stream_scan(scanner, file)
    except Exception as e:
        logger.debug(
            "Error scanning for bzip2 patterns",
            error=e,
        )
    if context.end_block_offset > 0:
        return ValidChunk(
            start_offset=start_offset, end_offset=context.end_block_offset
        )
    raise InvalidInputFormat("No valid bzip2 compression block was detected")