def _parse_enviroment(env_str):
 try:
  env = yaml.load(env_str, Loader=YamlLoader)
 except yaml.YAMLError:
  try:
   env = yaml.load(env_str, Loader=yaml.SafeLoader)
  except yaml.YAMLError as yea:
   raise ValueError(yea)
 else:
  if (env is None):
   env = {}
  elif (not isinstance(env, dict)):
   raise ValueError('The environment is not a valid YAML mapping data type.')
 for param in env:
  if (param not in SECTIONS):
   raise ValueError('environment has wrong section "{0}"'.format(param))
 return env

def _parse_enviroment ( env_str ) : try : env = yaml . load ( env_str , Loader = YamlLoader ) except yaml . YAMLError : try : env = yaml . load ( env_str , Loader = yaml . SafeLoader ) except yaml . YAMLError as yea : raise ValueError ( yea ) else : if ( env is None ) : env = { } elif ( not isinstance ( env , dict ) ) : raise ValueError ( 'The environment is not a valid YAML mapping data type.' ) for param in env : if ( param not in SECTIONS ) : raise ValueError ( 'environment has wrong section "{0}"' . format ( param ) ) return env
parsing template .