def extract_configs(configs, parent_dir):
 config_dir = os.path.join(parent_dir, 'configs')
 if os.path.isdir(configs):
  shutil.copytree(configs, config_dir, symlinks=True)
 elif tarfile.is_tarfile(configs):
  with tarfile.open(configs, 'r') as tar:
   tar.extractall(config_dir)
 else:
  raise errors.Error('Unknown configurations file type')
 return config_dir

def extract_configs ( configs , parent_dir ) : config_dir = os . path . join ( parent_dir , 'configs' ) if os . path . isdir ( configs ) : shutil . copytree ( configs , config_dir , symlinks = True ) elif tarfile . is_tarfile ( configs ) : with tarfile . open ( configs , 'r' ) as tar : tar . extractall ( config_dir ) else : raise errors . Error ( 'Unknown configurations file type' ) return config_dir
extracts configs to a new dir under parent_dir and returns it .