import time


def getTimestamp(t=None, fmt='%Y-%m-%d %H:%M:%S'):
    """Returns the timestamp for the given time (defaults to current time).
    The time should be in secs since epoch.

    .. note::
        The default `fmt` includes spaces and colons.
    """
    if not t:
        t = time.time()
    return time.strftime(fmt, time.localtime(t))