code: def clean_lines(commands):
      
      if isinstance(commands, basestring):
          # if the command argument is a filename, we need to open it.
          if path.isfile(commands):
              commands = open(commands, 'rb')
          # if the command string is a comma separated list, break it up.
          elif len(commands.split(',')) > 1:
              commands = commands.split(',')
          else:  # if a single command, need to just be returned.
              try:
                  if commands.strip()[0] != "#":
                      yield commands.strip() + '\n'
                      return
              except IndexError:
                  pass
      elif isinstance(commands, list):
          pass
      else:
          raise TypeError('clean_lines() accepts a \'str\' or \'list\'')
      for cmd in commands:
          # exclude commented lines, and skip blank lines (index error)
          try:
              if cmd.strip()[0] != "#":
                  yield cmd.strip() + '\n'
          except IndexError:
              pass
docs: Generate strings that are not comments or lines with only whitespace.
  
      Purpose: This function is a generator that will read in either a
             | plain text file of strings(IP list, command list, etc), a
             | comma separated string of strings, or a list of strings. It
             | will crop out any comments or blank lines, and yield
             | individual strings.
             |
             | Only strings that do not start with a comment '#', or are not
             | entirely whitespace will be yielded. This allows a file with
             | comments and blank lines for formatting neatness to be used
             | without a problem.
  
      @param commands: This can be either a string that is a file
                     | location, a comma separated string of strings
                     | ('x,y,z,1,2,3'), or a python list of strings.
      @type commands: str or list
  
      @returns: Yields each command in order
      @rtype: iterable of str