

def _determine_inheritance(template, template_dir, format):
    'Determines where to look for template based on user options'
    if (template is not None):
        (path, base) = os.path.split(template)
        if path:
            return (jinja2.FileSystemLoader(path), base)
    if (template_dir is not None):
        loader = jinja2.FileSystemLoader(template_dir)
    else:
        template_dir = os.path.expanduser('~/.dayone_export')
        if (template is not None):
            template_search_path = ['.', template_dir]
        else:
            template_search_path = [template_dir]
        loader = jinja2.ChoiceLoader([jinja2.FileSystemLoader(template_search_path), jinja2.PackageLoader('dayone_export')])
    if (template is None):
        template = (('default.' + format) if format else 'default.html')
    return (loader, template)

dataset/ETHPy150Open nathangrigg/dayone_export/dayone_export/__init__.py _determine_inheritance/original