def scoped_connection(func):
  '''
  Decorator that gives out connections.
  '''
  def _with(series, *args, **kwargs):
    connection = None
    try:
      connection = series._connection()
      return func(series, connection, *args, **kwargs)
    finally:
      series._return( connection )
  return _with
Decorator that gives out connections.