code: def register_model(cls, admin=None):
      
      cls.__url__ = '/{}'.format(cls.__name__.lower())
      service_class = type(
          cls.__name__ + 'Service',
          (Service,),
          {
              '__model__': cls,
          })
  
      # inspect primary key
      cols = list(cls().__table__.primary_key.columns)
  
      # composite keys not supported (yet)
      primary_key_type = 'string'
      if len(cols) == 1:
          col_type = cols[0].type
          # types defined at http://flask.pocoo.org/docs/0.10/api/#url-route-registrations
          if isinstance(col_type, sqltypes.String):
              primary_key_type = 'string'
          elif isinstance(col_type, sqltypes.Integer):
              primary_key_type = 'int'
          elif isinstance(col_type, sqltypes.Numeric):
              primary_key_type = 'float'
  
      # registration
      register_service(service_class, primary_key_type)
      if admin is not None:
          admin.add_view(CustomAdminView(cls, db.session))
docs: Register *cls* to be included in the API service
  
      :param cls: Class deriving from :class:`sandman2.models.Model`