def extract_stack(f=None, limit=None):
    """equivalent to traceback.extract_stack(), but also works with psyco
    """
    if f is not None:
        raise RuntimeError("Timba.utils.extract_stack: f has to be None, don't ask why")
    # normally we can just use the traceback.extract_stack() function and
    # cut out the last frame (which is just ourselves). However, under psyco
    # this seems to return an empty list, so we use sys._getframe() instead
    lim = limit
    if lim is not None:
        lim += 1
    tb = traceback.extract_stack(None, lim)
    if tb:
        return tb[:-1];  # skip current frame
    # else presumably running under psyco
    return nonportable_extract_stack(f, limit)