code: def precmd(self, line):
          
          if line == "":
              return ""
          command = line.split()[0]
          if "!" in command:
              value = command.split("!")[1]
              try:
                  ihist = int(value)
                  import readline
                  if ihist <= readline.get_current_history_length():
                      return readline.get_history_item(ihist)
                  else:
                      msg.warn("The specified history item {} ".format(ihist) + 
                               "does not exist in the history.")
                      return ""
              except ValueError:
                  #This clearly isn't a bash style recursion of a past history item.
                  #Just run the command as it was originally entered.
                  return line
          else:
              if command in self._test_cmds or command in self._group_cmds:
                  #We have to test the active unit test for both the test commands and the
                  #group commands, since the group commands rely on the active unit test.
                  if self.active is None or self.active not in self.tests:
                      msg.err("The specified command '{}' requires an ".format(command) + 
                              "active unit test to be loaded. Use 'parse' or 'load'.")
                      return ""
                  elif (command in self._group_cmds and (self.group is None or 
                                                         self.group not in self.args[self.active])):
                      msg.err("No valid analysis group is active. Use 'group' to create " 
                              "one or mark an existing one as active.")
                      return ""
                  else:
                      return line
  
              if command in self._var_cmds:
                  #We need to make sure that we have variables set.
                  if self.curargs["independent"] is None or len(self.curargs["dependents"]) == 0:
                      msg.err("This command requires an independent variable to be set and "
                              "at least one dependent variable.\n See 'dep' and 'indep' commands.")
                      return ""
                  else:
                      return line
              else:
                  return line
docs: Makes sure that the command specified in the line is valid given the current
          status of loaded unit tests and analysis group.