def import_and_get_class(path_to_pex, python_class_name):
abs_path_to_pex = os.path.abspath(path_to_pex)<EOL>Log.debug("<STR_LIT>" % abs_path_to_pex)<EOL>Log.debug("<STR_LIT>" % python_class_name)<EOL>split = python_class_name.split('<STR_LIT:.>')<EOL>from_path = '<STR_LIT:.>'.join(split[:-<NUM_LIT:1>])<EOL>import_name = python_class_name.split('<STR_LIT:.>')[-<NUM_LIT:1>]<EOL>Log.debug("<STR_LIT>" % (from_path, import_name))<EOL>if python_class_name.startswith("<STR_LIT>"):<EOL><INDENT>try:<EOL><INDENT>mod = resolve_heron_suffix_issue(abs_path_to_pex, python_class_name)<EOL>return getattr(mod, import_name)<EOL><DEDENT>except:<EOL><INDENT>Log.error("<STR_LIT>" % python_class_name)<EOL><DEDENT><DEDENT>mod = __import__(from_path, fromlist=[import_name], level=-<NUM_LIT:1>)<EOL>Log.debug("<STR_LIT>" % str(mod))<EOL>return getattr(mod, import_name)<EOL>
Imports and load a class from a given pex file path and python class name

    For example, if you want to get a class called `Sample` in
    /some-path/sample.pex/heron/examples/src/python/sample.py,
    ``path_to_pex`` needs to be ``/some-path/sample.pex``, and
    ``python_class_name`` needs to be ``heron.examples.src.python.sample.Sample``