def formatDateTime(dt, iso=False):
    """Converts a datetime object into a string.
    Uses ISO format (%Y-%m-%d %H:%M:%S) if "iso" is set to True; otherwise
    uses a pretty output format. NB currently the pretty output format is
    ISO as well...
    """
    return '%04i-%02i-%02i %02i:%02i:%02i' % (dt.year, dt.month, dt.day, dt
        .hour, dt.minute, dt.second)
