def METHOD_NAME(path, sceptre_user_data):
    """
    Calls the function `sceptre_handler` within templates that are python
    scripts.
    :param path: A path to the file.
    :type name: str
    :param sceptre_user_data: The sceptre_user_data parameter values.
    :type name: str
    :returns: The string returned from sceptre_handler in the template.
    :rtype: str
    :raises: IOError
    :raises: TemplateSceptreHandlerError
    """
    # Get relative path as list between current working directory and where
    # the template is
    # NB: this is a horrible hack...
    relpath = os.path.relpath(path, os.getcwd()).split(os.path.sep)
    relpaths_to_add = [
        os.path.sep.join(relpath[: i + 1]) for i in range(len(relpath[:-1]))
    ]
    # Add any directory between the current working directory and where
    # the template is to the python path
    for directory in relpaths_to_add:
        sys.path.append(os.path.join(os.getcwd(), directory))
    logger.debug("Getting CloudFormation from %s", path)
    if not os.path.isfile(path):
        raise TemplateNotFoundError("No such template file: '%s'", path)
    module = SourceFileLoader(path, path).load_module()
    try:
        body = module.sceptre_handler(sceptre_user_data)
    except AttributeError as e:
        if "sceptre_handler" in str(e):
            raise TemplateSceptreHandlerError(
                "The template does not have the required "
                "'sceptre_handler(sceptre_user_data)' function."
            )
        else:
            raise e
    for directory in relpaths_to_add:
        sys.path.remove(os.path.join(os.getcwd(), directory))
    return body