code: def get_ports(proto='tcp', direction='in'):
      '''
      Lists ports from csf.conf based on direction and protocol.
      e.g. - TCP_IN, TCP_OUT, UDP_IN, UDP_OUT, etc..
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' csf.allow_port 22 proto='tcp' direction='in'
      '''
  
      proto = proto.upper()
      direction = direction.upper()
      results = {}
      _validate_direction_and_proto(direction, proto)
      directions = build_directions(direction)
      for direction in directions:
          option = '{0}_{1}'.format(proto, direction)
          results[direction] = _csf_to_list(option)
  
      return resultf get_ports(proto='tcp', direction='in'):
      '''
      Lists ports from csf.conf based on direction and protocol.
      e.g. - TCP_IN, TCP_OUT, UDP_IN, UDP_OUT, etc..
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' csf.allow_port 22 proto='tcp' direction='in'
      '''
  
      proto = proto.upper()
      direction = direction.upper()
      results = {}
      _validate_direction_and_proto(direction, proto)
      directions = build_directions(direction)
      for direction in directions:
          option = '{0}_{1}'.format(proto, direction)
          results[direction] = _csf_to_list(option)
  
      return results
docs: Lists ports from csf.conf based on direction and protocol.
      e.g. - TCP_IN, TCP_OUT, UDP_IN, UDP_OUT, etc..
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' csf.allow_port 22 proto='tcp' direction='in'