def set_up():
    """
    Set ups the V8 machinery:\
    platform, VM and context.

    This function is not thread-safe,\
    it must be called from a place\
    where is guaranteed it will be\
    called once and only once.\
    Probably within the main-thread\
    at import time.
    """
    global _context

    if _context is not None:
        raise AssertionError(
            'This function must only be called '
            'once in an application lifetime')

    platform.set_up()
    vm = platform.create_vm()
    vm.set_up()
    _context = vm.create_context()
    _context.set_up()
    atexit.register(_tear_down)