docs: def parse_compound_file(path, format):
      """Open and parse reaction file based on file extension or given format
  
      Path can be given as a string or a context.
      """
  
      context = FilePathContext(path)
  
      # YAML files do not need to explicitly specify format
      format = resolve_format(format, context.filepath)
      if format == 'yaml':
          logger.debug('Parsing compound file {} as YAML'.format(
              context.filepath))
          with context.open('r') as f:
              for compound in parse_compound_yaml_file(context, f):
                  yield compound
      elif format == 'modelseed':
          logger.debug('Parsing compound file {} as ModelSEED TSV'.format(
              context.filepath))
          with context.open('r') as f:
              for compound in modelseed.parse_compound_file(f, context):
                  yield compound
      elif format == 'tsv':
          logger.debug('Parsing compound file {} as TSV'.format(
              context.filepath))
          with context.open('r') as f:
              for compound in parse_compound_table_file(context, f):
                  yield compound
      else:
          raise ParseError('Unable to detect format of compound file {}'.format(
              context.filepath))