title: serializing and deserializing lambdas
body: <p>I would like to serialize on machine A and deserialize on machine B a python lambda. There are a couple of obvious problems with that:</p>
  
  <ul>
  <li>the pickle module does not serialize or deserialize code. It only serializes the names of classes/methods/functions</li>
  <li>some of the answers I found with google suggest the use of the low-level marshal module to serialize the func_code attribute of the lambda but they fail to describe how one could reconstruct a function object from the deserialized code object</li>
  <li>marhshal(l.func_code) will not serialize the closure associated with the lambda which leads to the problem of detecting when a given lambda really needs a closure and warning the user that he is trying to serialize a lambda that uses a closure</li>
  </ul>
  
  <p>Hence, my question(s):</p>
  
  <ul>
  <li>how would one reconstruct a function from the deserialized (demarshaled) code object ?</li>
  <li>how would one detect that a given lambda will not work properly without the associated closure ?</li>
  </ul>