title: Good way to write a lightweight client function to be imported Twisted Python
body: <p>I have the following server running:</p>
  
  <pre><code>class ThasherProtocol(basic.LineReceiver):
      def lineReceived(self, line):
          dic = simplejson.loads( line)
          ret = self.factory.d[ dic['method'] ]( dic['args'] )
          self.transport.write( simplejson.dumps( ret) )
          self.transport.loseConnection()
  
  
  
  class ThasherFactory(ServerFactory):
      protocol = ThasherProtocol 
  
      def __init__(self):
          self.thasher = Thasher()
          self.d= {   
              'getHash': self.thasher.getHash,
              'sellHash' : self.thasher.sellHash
              }
  
  
  reactor.listenUNIX( c.LOCATION_THASHER, ThasherFactory() )
  reactor.run()
  </code></pre>
  
  <p>I have multiple files importing a special function called "getHash" from a particular file.
  Note that getHash's arguments are only gonna be a dictionary of texts (strings). 
  How do I write a client function (getHash) that can be simply:</p>
  
  <pre><code>from particular file import getHash
  i = getHash( { 'type':'url', 'url':'http://www.stackoverflow.com' } )
  </code></pre>
  
  <p>Note that ALL I WANT TO DO is:
  1) dump a dict into json, 
  2) dump that json into the particular socket, 
  3) wait for that to come back and unpack the json</p>