code: def parse(file_path):
      '''Parse a YAML or JSON file.'''
  
      _, ext = path.splitext(file_path)
  
      if ext in ('.yaml', '.yml'):
          func = yaml.load
  
      elif ext == '.json':
          func = json.load
  
      else:
          raise ValueError("Unrecognized config file type %s" % ext)
  
      with open(file_path, 'r') as f:
          return func(ff parse(file_path):
      '''Parse a YAML or JSON file.'''
  
      _, ext = path.splitext(file_path)
  
      if ext in ('.yaml', '.yml'):
          func = yaml.load
  
      elif ext == '.json':
          func = json.load
  
      else:
          raise ValueError("Unrecognized config file type %s" % ext)
  
      with open(file_path, 'r') as f:
          return func(f)
docs: Parse a YAML or JSON file.