def program_name(filename, func):
    """Choose program name for application

    Iterate backwards through absolute path for application looking for first
    name that is not a magic variable.
    """
    fullpath = os.path.abspath(filename)
    basename, filename = os.path.split(fullpath)
    while len(basename) > 0:
        if not filename.startswith('__'):
            return filename
        basename, filename = os.path.split(basename)
    return func.__name__
dataset/ETHPy150Open aliles/begins/begin/cmdline.py/program_name/original