def get_perm_name(cls, action, full=True):
    """
    Return the name of the permission for a given model and action.

    By default it returns the full permission name `app_label.perm_codename`. If `full=False`, it returns only the
    `perm_codename`.
    """
    codename = "{}_{}".format(action, cls.__name__.lower())
    if full:
        return "{}.{}".format(cls._meta.app_label, codename)
    return codename