def _sorted(dict_):
  """Returns a sorted list from the dict, with error if keys not sortable."""
  try:
    return sorted(dict_.iterkeys())
  except TypeError:
    raise TypeError("nest only supports dicts with sortable keys.")