Basic support for 3.6's f-strings, in 3.5!

    Formats "s" using appropriate globals and locals
    dictionaries.  This f-string:
        f"hello a is {a}"
    simply becomes
        f("hello a is {a}")
    In other words, just throw parentheses around the
    string, and you're done!

    Implemented internally using str.format_map().
    This means it doesn't support expressions:
        f("two minus three is {2-3}")
    And it doesn't support function calls:
        f("how many elements? {len(my_list)}")
    But most other f-string features work.

def f(s):
    """
    Basic support for 3.6's f-strings, in 3.5!

    Formats "s" using appropriate globals and locals
    dictionaries.  This f-string:
        f"hello a is {a}"
    simply becomes
        f("hello a is {a}")
    In other words, just throw parentheses around the
    string, and you're done!

    Implemented internally using str.format_map().
    This means it doesn't support expressions:
        f("two minus three is {2-3}")
    And it doesn't support function calls:
        f("how many elements? {len(my_list)}")
    But most other f-string features work.
    """
    frame = sys._getframe(1)
    d = dict(builtins.__dict__)
    d.update(frame.f_globals)
    d.update(frame.f_locals)
    return s.format_map(d)