.. versionadded:: 2019.2.0

    Performs the action as called from ``port_add_policy`` or ``port_delete_policy``.

    Returns the result of the call to semanage.

def _port_add_or_delete_policy(action, name, sel_type=None, protocol=None, port=None, sel_range=None):
    '''
    .. versionadded:: 2019.2.0

    Performs the action as called from ``port_add_policy`` or ``port_delete_policy``.

    Returns the result of the call to semanage.
    '''
    if action not in ['add', 'delete']:
        raise SaltInvocationError('Actions supported are "add" and "delete", not "{0}".'.format(action))
    if action == 'add' and not sel_type:
        raise SaltInvocationError('SELinux Type is required to add a policy')
    (protocol, port) = _parse_protocol_port(name, protocol, port)
    cmd = 'semanage port --{0} --proto {1}'.format(action, protocol)
    if sel_type:
        cmd += ' --type {0}'.format(sel_type)
    if sel_range:
        cmd += ' --range {0}'.format(sel_range)
    cmd += ' {0}'.format(port)
    return __salt__['cmd.run_all'](cmd)