code: def _port_op(op_name, port, protocol="TCP"):
      
      _args = [op_name]
      icmp = protocol.upper() == "ICMP"
      if icmp:
          _args.append(protocol)
      else:
          _args.append('{}/{}'.format(port, protocol))
      try:
          subprocess.check_call(_args)
      except subprocess.CalledProcessError:
          # Older Juju pre 2.3 doesn't support ICMP
          # so treat it as a no-op if it fails.
          if not icmp:
              raise
docs: Open or close a service network port