def packet(*args)
      code = args.pick(String,:code)
      base_namespace = args.pick(:base_namespace) do nil end
      no_base_namespace = args.pick(:no_base_namespace) do @no_base_namespace end
      privileges_ = args.pick(Privileges,:privileges) do Privileges.new end
      encoding = get_source_encoding(code) || args.pick(:encoding) do nil end

      hook_handler = nil

      if base_namespace
        hook_handler = instantiate_evalhook_handler
        hook_handler.base_namespace = base_namespace
        hook_handler.sandbox = self
      else
        hook_handler = @hook_handler
        base_namespace = hook_handler.base_namespace
      end
      source = args.pick(:source) do generate_id end

      self.privileges[source] = privileges_

      code = "nil;\n " + code

      unless no_base_namespace
        if (eval(base_namespace.to_s).instance_of? Module)
          code = "module #{base_namespace}\n #{code}\n end\n"
        else
          code = "class #{base_namespace}\n #{code}\n end\n"
        end
      end

      if encoding
        code = "# encoding: #{encoding}\n" + code
      end

      evalhook_packet = @hook_handler.packet(code)
      Shikashi::Sandbox::Packet.new(evalhook_packet, privileges_, source)
    end
def packet(*args)
      code = args.pick(String,:code)
      base_namespace = args.pick(:base_namespace) do nil end
      no_base_namespace = args.pick(:no_base_namespace) do @no_base_namespace end
      privileges_ = args.pick(Privileges,:privileges) do Privileges.new end
      encoding = get_source_encoding(code) || args.pick(:encoding) do nil end

      hook_handler = nil

      if base_namespace
        hook_handler = instantiate_evalhook_handler
        hook_handler.base_namespace = base_namespace
        hook_handler.sandbox = self
      else
        hook_handler = @hook_handler
        base_namespace = hook_handler.base_namespace
      end
      source = args.pick(:source) do generate_id end

      self.privileges[source] = privileges_

      code = "nil;\n " + code

      unless no_base_namespace
        if (eval(base_namespace.to_s).instance_of? Module)
          code = "module #{base_namespace}\n #{code}\n end\n"
        else
          code = "class #{base_namespace}\n #{code}\n end\n"
        end
      end

      if encoding
        code = "# encoding: #{encoding}\n" + code
      end

      evalhook_packet = @hook_handler.packet(code)
      Shikashi::Sandbox::Packet.new(evalhook_packet, privileges_, source)
    end
Creates a packet of code with the given privileges to execute later as many times as neccessary

 (see examples)

 Arguments

 :code             Mandatory argument of class String with the code to execute restricted in the sandbox
 :privileges       Optional argument of class Shikashi::Sandbox::Privileges to indicate the restrictions of the
                   code executed in the sandbox. The default is an empty Privileges (absolutly no permission)
                   Must be of class Privileges or passed as hash_key (:privileges => privileges)
 :source           Optional argument to indicate the "source name", (visible in the backtraces). Only can
                   be specified as hash parameter
 :base_namespace   Alternate module to contain all classes and constants defined by the unprivileged code
                   if not specified, by default, the base_namespace is created with the sandbox itself
 :no_base_namespace  Specify to do not use a base_namespace (default false, not recommended to change)
 :encoding           Specify the encoding of source (example: "utf-8"), the encoding also can be
                     specified on header like a ruby normal source file

 NOTE: arguments are the same as for Sandbox#run method, except for timeout and binding which can be
 used when calling Shikashi::Sandbox::Packet#run

Example:

 require "rubygems"
 require "shikashi"

 include Shikashi

 sandbox = Sandbox.new

 privileges = Privileges.allow_method(:print)

 # this is equivallent to sandbox.run('print "hello world\n"')
 packet = sandbox.packet('print "hello world\n"', privileges)
 packet.run