

def safe_path(root, log_name):
    'Pull out a safe path from a url.\n\n    Basically we need to ensure that the final computed path\n    remains under the root path. If not, we return None to indicate\n    that we are very sad.\n    '
    if (log_name is not None):
        newpath = os.path.abspath(os.path.join(log_name, log_name))
        if (newpath.find(root) == 0):
            return newpath
    return None

dataset/ETHPy150Open openstack-infra/os-loganalyze/os_loganalyze/generator.py safe_path/VarMisuse@38/132 `root`->`log_name`