# Some useful functions

import time


def timestamp():
    """
    Return our standard timestamp, the unix epic seconds, accurate to 4 decimal places.

    :return: str
    """
    return '{0:.4f}'.format(time.time())


def format_float(f):
    fmt = '{0:.3f}'
    if f is None:
        return " "
    else:
        return fmt.format(f)


def conv_s2hms(seconds, short=False):
    """
    Converts seconds to hours, minutes and seconds.

    :param seconds: The time in seconds to use
    :type seconds: int

    :return: str
    """
    seconds = int(seconds)
    hours = seconds / 3600
    seconds -= 3600 * hours
    minutes = seconds / 60
    seconds -= 60 * minutes
    if hours == 0 and short is True:
        return "%02d:%02d" % (minutes, seconds)
    return "%02d:%02d:%02d" % (hours, minutes, seconds)


console_colors = {
    'norm': '\033[0m',
    'bold': '\033[1m',
    'red': '\033[31m',
    'green': '\033[32m',
    'orange': '\033[33m',
    'yellow': '\033[33m',
    'blue': '\033[34m',
    'magenta': '\033[35m',
    'purple': '\033[35m',
    'cyan': '\033[36m',
    'white': '\033[37m',
}


# noinspection PyPep8Naming
def printColor(msg, color, newline=True):
    """
    Prints a string in color

    :param msg: Text to colorize
    :type msg: str
    :param color: Color, one of those listed in helpers.console_colors
    :type color: str
    :param newline: Whether or not to terminate string with a carriage return
    :type newline: bool

    :return: None (print to console)
    """
    nl = os.linesep if newline else ''
    sys.stdout.write('%s%s' % (colorize(msg, color), nl))
    sys.stdout.flush()


def colorize(msg, color):
    """
    Colorize a string and return the string

    :param msg: Text to colorize
    :type msg: str
    :param color: Color, one of those listed in helpers.console_colors
    :type color: str

    :return: str
    """
    return '%s%s%s' % (console_colors[color], msg, console_colors['norm'])


@@ -30,16 +30,26 @@
 rt time%0A
+import sys
 %0A%0Adef ti
@@ -339,24 +339,496 @@
 format(f)%0A%0A%0A
+def progress_bar(progress_bar_time=1, end_val=100, bar_size=20):%0A    for i in xrange(0, end_val+1):%0A        percent = float(i) / end_val%0A        hashes = '#' * int(round(percent * bar_size))%0A        spaces = ' ' * (bar_size - len(hashes))%0A        sys.stdout.write(%22%5CrPercent: %5B%7B0%7D%5D %7B1%7D%25%22.format(hashes + spaces, int(round(percent * 100))))%0A        sys.stdout.flush()%0A        time.sleep(progress_bar_time/float(end_val))%0A    sys.stdout.write('%5Cn')%0A    sys.stdout.flush()%0A%0A%0A
 def conv_s2h

Add console progress bar utility