+def _get_verbose_prints(verbose):
+ """If `verbose` is true, returns two functions: one for printing a starting
+ message, and the other for printing a success or failure message when
+ finished.
+
+ If `verbose` is false, returns two no-op functions.
+ """
+
+ if verbose:
+ import sys
+ def print_start(thing):
+ # Truncate to 66 characters, leaving 10 characters for a success
+ # or failure message
+ truncated_thing = thing[0:66]
+
+ # Also, space-pad to keep the cursor in a known column
+ num_spaces = 66 - len(truncated_thing)
+
+ print "%s...%s" % (truncated_thing, ' ' * num_spaces),
+ sys.stdout.flush()
+
+ def print_done(msg='ok'):
+ print msg
+ sys.stdout.flush()
+
+ return print_start, print_done
+
+ # Not verbose; return dummies
+ def dummy(*args, **kwargs):
+ pass
+
+ return dummy, dummy
+
+
+def load(session, directory=None, drop_tables=False, verbose=False):