code: def issorted(table, key=None, reverse=False, strict=False):
      
  
      # determine the operator to use when comparing rows
      if reverse and strict:
          op = operator.lt
      elif reverse and not strict:
          op = operator.le
      elif strict:
          op = operator.gt
      else:
          op = operator.ge
  
      it = iter(table)
      flds = [text_type(f) for f in next(it)]
      if key is None:
          prev = next(it)
          for curr in it:
              if not op(curr, prev):
                  return False
              prev = curr
      else:
          getkey = comparable_itemgetter(*asindices(flds, key))
          prev = next(it)
          prevkey = getkey(prev)
          for curr in it:
              currkey = getkey(curr)
              if not op(currkey, prevkey):
                  return False
              prevkey = currkey
      return True
docs: Return True if the table is ordered (i.e., sorted) by the given key. E.g.::
  
          >>> import petl as etl
          >>> table1 = [['foo', 'bar', 'baz'],
          ...           ['a', 1, True],
          ...           ['b', 3, True],
          ...           ['b', 2]]
          >>> etl.issorted(table1, key='foo')
          True
          >>> etl.issorted(table1, key='bar')
          False
          >>> etl.issorted(table1, key='foo', strict=True)
          False
          >>> etl.issorted(table1, key='foo', reverse=True)
          False