return a path to an R package resource, if it is available

def R_package_resource(package, resource):
    """
    return a path to an R package resource, if it is available
    """
    package_path = R_package_path(package)
    if not package_path:
        return None
    package_resource = os.path.join(package_path, resource)
    if not file_exists(package_resource):
        return None
    else:
        return package_resource