docs: def create_model(modelname, fields, indexes=None, basemodel=None, **props):
      """
      Create model dynamically
  
      :param fields: Just format like [
                          {'name':name, 'type':type, ...},
                          ...
                          ]
                      type should be a string, eg. 'str', 'int', etc
                      kwargs will be passed to Property.__init__() according field type,
                      it'll be a dict
      :param props: Model attributes, such as '__mapping_only__', '__replace__'
      :param indexes: Multiple fields index, single index can be set directly using `index=True`
                      to a field, the value format should be:
  
                      [
                          {'name':name, 'fields':[...], ...},
                      ]
  
                      e.g. [
                          {'name':'audit_idx', 'fields':['table_id', 'obj_id']}
                      ]
  
                      for kwargs can be ommited.
  
      :param basemodel: Will be the new Model base class, so new Model can inherited
                      parent methods, it can be a string or a real class object
      """
      assert not props or isinstance(props, dict)
      assert not indexes or isinstance(indexes, list)
  
      props = SortedDict(props or {})
      props['__dynamic__'] = True
      props['__config__'] = False
  
      for p in fields:
          kwargs = p.copy()
          name = kwargs.pop('name')
          _type = kwargs.pop('type')
  
          #if the key is start with '_', then remove it
          for k in kwargs.keys():
              if k.startswith('_'):
                  kwargs.pop(k, None)
  
          field_type = get_field_type(_type)
          prop = field_type(**kwargs)
          props[name] = prop
  
      if basemodel:
          model = import_attr(basemodel)
          # model.clear_relation()
      else:
          model = Model
      # try:
      #     old = get_model(modelname, signal=False)
      #     old.clear_relation()
      # except ModelNotFound as e:
      #     pass
  
      cls = type(str(modelname.title()), (model,), props)
  
      tablename = props.get('__tablename__', modelname)
      set_model(cls, tablename, appname=__name__, model_path='')
      get_model(modelname, signal=False, reload=True)
  
      indexes = indexes or []
      for x in indexes:
          kwargs = x.copy()
          name = kwargs.pop('name')
          fields = kwargs.pop('fields')
  
          #if the key is start with '_', then remove it
          for k in kwargs.keys():
              if k.startswith('_'):
                  kwargs.pop(k, None)
  
          if not isinstance(fields, (list, tuple)):
              raise ValueError("Index value format is not right, the value is %r" % indexes)
  
          props = []
          for y in fields:
              props.append(cls.c[y])
  
          Index(name, *props, **kwargs)
  
      return cls