def _get_preprocessed(self, data):
from rez.serialise import process_python_objects<EOL>from rez.utils.data_utils import get_dict_diff_str<EOL>from copy import deepcopy<EOL>with add_sys_paths(config.package_definition_build_python_paths):<EOL><INDENT>preprocess_func = getattr(self, "<STR_LIT>", None)<EOL>if preprocess_func:<EOL><INDENT>print_info("<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>dotted = self.config.package_preprocess_function<EOL>if not dotted:<EOL><INDENT>return None<EOL><DEDENT>if '<STR_LIT:.>' not in dotted:<EOL><INDENT>print_error(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL>return None<EOL><DEDENT>name, funcname = dotted.rsplit('<STR_LIT:.>', <NUM_LIT:1>)<EOL>try:<EOL><INDENT>module = __import__(name=name, fromlist=[funcname])<EOL><DEDENT>except Exception as e:<EOL><INDENT>print_error("<STR_LIT>"<EOL>% (dotted, str(e)))<EOL>return None<EOL><DEDENT>setattr(module, "<STR_LIT>", InvalidPackageError)<EOL>preprocess_func = getattr(module, funcname)<EOL>if not preprocess_func or not isfunction(isfunction):<EOL><INDENT>print_error("<STR_LIT>" % dotted)<EOL>return None<EOL><DEDENT>print_info("<STR_LIT>" % dotted)<EOL><DEDENT>preprocessed_data = deepcopy(data)<EOL>try:<EOL><INDENT>preprocess_func(this=self, data=preprocessed_data)<EOL><DEDENT>except InvalidPackageError:<EOL><INDENT>raise<EOL><DEDENT>except Exception as e:<EOL><INDENT>print_error("<STR_LIT>"<EOL>% (e.__class__.__name__, str(e)))<EOL>return None<EOL><DEDENT><DEDENT>preprocessed_data = process_python_objects(preprocessed_data)<EOL>if preprocessed_data == data:<EOL><INDENT>return None<EOL><DEDENT>package = create_package(self.name, preprocessed_data,<EOL>package_cls=self.__class__)<EOL>txt = get_dict_diff_str(<EOL>data,<EOL>preprocessed_data,<EOL>title="<STR_LIT>"<EOL>)<EOL>print_info(txt)<EOL>return package, preprocessed_data<EOL>
Returns:
    (DeveloperPackage, new_data) 2-tuple IFF the preprocess function
    changed the package; otherwise None.