code: def permission_to_perm(permission):
      
      app_label = permission.content_type.app_label
      codename = permission.codename
      return '%s.%s' % (app_label, codename)
docs: Convert a permission instance to a permission-string.
  
      Examples
      --------
      >>> permission = Permission.objects.get(
      ...     content_type__app_label='auth',
      ...     codename='add_user',
      ... )
      >>> permission_to_perm(permission)
      'auth.add_user'