def METHOD_NAME(
    clvm_filename, package_or_requirement=__name__, include_standard_libraries: bool = True, recompile: bool = True
) -> SerializedProgram:
    """
    This function takes a .clsp file in the given package and compiles it to a
    .clsp.hex file if the .hex file is missing or older than the .clsp file, then
    returns the contents of the .hex file as a `Program`.
    clvm_filename: file name
    package_or_requirement: usually `__name__` if the clvm file is in the same package
    """
    hex_filename = f"{clvm_filename}.hex"
    # Set the CHIA_DEV_COMPILE_CLVM_ON_IMPORT environment variable to anything except
    # "" or "0" to trigger automatic recompilation of the Chialisp on load.
    if recompile:
        try:
            if pkg_resources.resource_exists(package_or_requirement, clvm_filename):
                # Establish whether the size is zero on entry
                full_path = pathlib.Path(pkg_resources.resource_filename(package_or_requirement, clvm_filename))
                output = full_path.parent / hex_filename
                if not output.exists() or os.stat(full_path).st_mtime > os.stat(output).st_mtime:
                    search_paths = [full_path.parent]
                    if include_standard_libraries:
                        # we can't get the dir, but we can get a file then get its parent.
                        chia_puzzles_path = pathlib.Path(
                            pkg_resources.resource_filename(__name__, "__init__.py")
                        ).parent
                        search_paths.append(chia_puzzles_path)
                    compile_clvm(full_path, output, search_paths=search_paths)
        except NotImplementedError:
            # pyinstaller doesn't support `pkg_resources.resource_exists`
            # so we just fall through to loading the hex clvm
            pass
    clvm_hex = pkg_resources.resource_string(package_or_requirement, hex_filename).decode("utf8")
    assert len(clvm_hex.strip()) != 0
    clvm_blob = bytes.fromhex(clvm_hex)
    return SerializedProgram.from_bytes(clvm_blob)