code: def set_alias(alias, **kwargs):
      
  
      spec = alias.split()
      path = spec[0]
  
      values = {**kwargs, 'path': path}
  
      if len(spec) > 1:
          values['template'] = spec[1]
  
      record = model.PathAlias.get(path=path)
      if record:
          record.set(**values)
      else:
          record = model.PathAlias(**values)
  
      orm.commit()
      return record
docs: Set a path alias.
  
      Arguments:
  
      alias -- The alias specification
      entry -- The entry to alias it to
      category -- The category to alias it to
      url -- The external URL to alias it to