def _yaml_configuration_path_option(option_name, option_value):
 yaml_path = _existing_file_path_option(option_name, option_value)
 try:
  configuration = yaml.safe_load(yaml_path.open())
 except ParserError as e:
  raise UsageError(u'Problem with --{}. Unable to parse YAML from {}. Error message: {}.'.format(option_name, yaml_path.path, unicode(e)))
 return configuration

def _yaml_configuration_path_option ( option_name , option_value ) : yaml_path = _existing_file_path_option ( option_name , option_value ) try : configuration = yaml . safe_load ( yaml_path . open ( ) ) except ParserError as e : raise UsageError ( u'Problem with --{}. Unable to parse YAML from {}. Error message: {}.' . format ( option_name , yaml_path . path , unicode ( e ) ) ) return configuration
validate a command line option containing a filepath to a yaml file .