code: def then_by(self, key_selector=identity):
          '''Introduce subsequent ordering to the sequence with an optional key.
          The returned sequence will be sorted in ascending order by the
          selected key.
          Note: This method uses deferred execution.
          Args:
              key_selector: A unary function the only positional argument to
                  which is the element value from which the key will be
                  selected.  The return value should be the key from that
                  element.
          Returns:
              An OrderedQueryable over the sorted items.
          Raises:
              ValueError: If the OrderedQueryable is closed().
              TypeError: If key_selector is not callable.
          '''
          if self.closed():
              raise ValueError("Attempt to call then_by() on a "
                               "closed OrderedQueryable.")
          if not is_callable(key_selector):
              raise TypeError("then_by() parameter key_selector={key_selector} "
                      "is not callable".format(key_selector=repr(key_selector)))
          self._funcs.append((-1, key_selector))
          return self