The Source Executor

  This executor is designed to allow creation of pickleable executors
  that come from non-importable sources such as text extracted from
  the source provided to a Twiddler.

  It does this by compiling the provided text as required to provide a
  python function:

  >>> from twiddler.executor.source import Source
  >>> s = Source('''
  ... def some_method():
  ...    print "running!"
  ... ''')
  >>> s()
  running!

  The source may only contain one top level element, which should be a
  python function. If any other definitions are made in the source, an
  exception will be raised:

  >>> s = Source('''
  ... x = 0
  ... def some_method():
  ...    print x
  ... ''')
  Traceback (most recent call last):
  ...
  SyntaxError:...

  If you really do need to define more than one top level element, you
  must specify the name of the function to use:

  >>> s = Source('''
  ... def some_other_method():
  ...    print "running some other method!"
  ... def some_method():
  ...    print "running some method!"
  ...    some_other_method()
  ... ''',
  ...            name='some_method')
  >>> s()
  running some method!
  running some other method!

  Pickling is done the same way as for any other python object:

  >>> from pickle import loads,dumps
  >>> pickle = dumps(s)

  Once a pickle has been taken, you can still call the executor:

  >>> s()
  running some method!
  running some other method!

  You can also reconstitute it from the pickle:
  
  >>> s2 = loads(pickle)

  The reconstituted executor can be called as many times as you need:

  >>> s2()
  running some method!
  running some other method!
  >>> s2()
  running some method!
  running some other method!
  

