code: def _id_handler(self, f):
          if isinstance(self.id_spec, six.string_types):
              id_key = [self.id_spec]
          elif hasattr(self.id_spec, '__call__'):
              id_key = [self.id_spec]
          elif isinstance(self.id_spec, dict):
              try:
                  id_key = self.id_spec[f.featuretype]
                  if isinstance(id_key, six.string_types):
                      id_key = [id_key]
              except KeyError:
                  return self._increment_featuretype_autoid(f.featuretype)
          else:
              id_key = self.id_spec
          for k in id_key:
              if hasattr(k, '__call__'):
                  _id = k(f)
                  if _id:
                      if _id.startswith('autoincrement:'):
                          return self._increment_featuretype_autoid(_id[14:])
                      return _id
              else:
                  if (len(k) > 3) and (k[0] == ':') and (k[-1] == ':'):
                      return getattr(f, k[1:-1])
                  else:
                      try:
                          return f.attributes[k][0]
                      except (KeyError, IndexError):
                          pass
          return self._increment_featuretype_autoid(f.featuretype)