code: def _access_rule(method,
                  ip=None,
                  port=None,
                  proto='tcp',
                  direction='in',
                  port_origin='d',
                  ip_origin='d',
                  comment=''):
      '''
      Handles the cmd execution for allow and deny commands.
      '''
      if _status_csf():
          if ip is None:
              return {'error': 'You must supply an ip address or CIDR.'}
          if port is None:
              args = _build_args(method, ip, comment)
              return __csf_cmd(args)
          else:
              if method not in ['allow', 'deny']:
                  return {'error': 'Only allow and deny rules are allowed when specifying a port.'}
              return _access_rule_with_port(method=method,
                                              ip=ip,
                                              port=port,
                                              proto=proto,
                                              direction=direction,
                                              port_origin=port_origin,
                                              ip_origin=ip_origin,
                                              comment=commentf _access_rule(method,
                  ip=None,
                  port=None,
                  proto='tcp',
                  direction='in',
                  port_origin='d',
                  ip_origin='d',
                  comment=''):
      '''
      Handles the cmd execution for allow and deny commands.
      '''
      if _status_csf():
          if ip is None:
              return {'error': 'You must supply an ip address or CIDR.'}
          if port is None:
              args = _build_args(method, ip, comment)
              return __csf_cmd(args)
          else:
              if method not in ['allow', 'deny']:
                  return {'error': 'Only allow and deny rules are allowed when specifying a port.'}
              return _access_rule_with_port(method=method,
                                              ip=ip,
                                              port=port,
                                              proto=proto,
                                              direction=direction,
                                              port_origin=port_origin,
                                              ip_origin=ip_origin,
                                              comment=comment)
docs: Handles the cmd execution for allow and deny commands.