code: def _parse_command_spec(self, spec, precmds):
          '''
          Run pre_commands
          '''
          if 'pre_command' in spec:
              precmd_alias = spec['pre_command']
              try:
                  precmd = precmds[precmd_alias]
  
                  if self._blacklist_check(precmd):
                      raise RuntimeError("Command Blacklist: " + precmd)
  
                  args = self._run_pre_command(precmd)
                  logger.debug('Pre-command results: %s', args)
  
                  expanded_specs = []
                  for arg in args:
                      _spec = copy.copy(spec)
                      _spec['command'] = _spec['command'] + ' ' + arg
                      expanded_specs.append(_spec)
                  return expanded_specs
              except LookupError:
                  logger.debug('Pre-command %s not found. Skipping %s...',
                               precmd_alias, spec['command'])
                  return []
          else:
              return [specf _parse_command_spec(self, spec, precmds):
          '''
          Run pre_commands
          '''
          if 'pre_command' in spec:
              precmd_alias = spec['pre_command']
              try:
                  precmd = precmds[precmd_alias]
  
                  if self._blacklist_check(precmd):
                      raise RuntimeError("Command Blacklist: " + precmd)
  
                  args = self._run_pre_command(precmd)
                  logger.debug('Pre-command results: %s', args)
  
                  expanded_specs = []
                  for arg in args:
                      _spec = copy.copy(spec)
                      _spec['command'] = _spec['command'] + ' ' + arg
                      expanded_specs.append(_spec)
                  return expanded_specs
              except LookupError:
                  logger.debug('Pre-command %s not found. Skipping %s...',
                               precmd_alias, spec['command'])
                  return []
          else:
              return [spec]
docs: Run pre_commands