def shell_expand(path, expand_relative_paths=False):
 if path:
  path = os.path.expanduser(os.path.expandvars(path))
  if (expand_relative_paths and (not path.startswith('/'))):
   if ('CONFIG_FILE' in globals()):
    CFGDIR = os.path.dirname(CONFIG_FILE)
    path = os.path.join(CFGDIR, path)
   path = os.path.abspath(path)
 return path

def shell_expand ( path , expand_relative_paths = False ) : if path : path = os . path . expanduser ( os . path . expandvars ( path ) ) if ( expand_relative_paths and ( not path . startswith ( '/' ) ) ) : if ( 'CONFIG_FILE' in globals ( ) ) : CFGDIR = os . path . dirname ( CONFIG_FILE ) path = os . path . join ( CFGDIR , path ) path = os . path . abspath ( path ) return path
shell_expand is needed as os .