def set_fortpy_templates(obj, fortpy_templates=None):
    """Sets the directory path for the fortpy templates. If no directory
    is specified, use the default one that shipped with the package.
    """
    #If they didn't specify a custom templates directory, use the default
    #one that shipped with the package.
    from os import path
    if fortpy_templates is not None:
        obj.fortpy_templates = path.abspath(path.expanduser(fortpy_templates))
    else:
        from fortpy.utility import get_fortpy_templates_dir
        obj.fortpy_templates = get_fortpy_templates_dir()
Sets the directory path for the fortpy templates. If no directory
    is specified, use the default one that shipped with the package.