code: def service(name, action):
      
      if action == 'open':
          subprocess.check_output(['ufw', 'allow', str(name)],
                                  universal_newlines=True)
      elif action == 'close':
          subprocess.check_output(['ufw', 'delete', 'allow', str(name)],
                                  universal_newlines=True)
      else:
          raise UFWError(("'{}' not supported, use 'allow' "
                          "or 'delete'").format(action))
docs: Open/close access to a service
  
      :param name: could be a service name defined in `/etc/services` or a port
                   number.
      :param action: `open` or `close`