# Load balanced map and parallel function decorator

    from __future__ import print_function
    import ipyparallel as ipp

    rc = ipp.Client()
    v = rc.load_balanced_view()

    result = v.map(lambda x: 2*x, range(10))
    print("Simple, default map: ", list(result))

    Simple, default map:  [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]

    ar = v.map_async(lambda x: 2*x, range(10))
    print("Submitted tasks, got ids: ", ar.msg_ids)
    result = ar.get()
    print("Using a mapper: ", result)

    Submitted tasks, got ids:  ['b21595ef-61f4-4ec3-ac7a-7888c025e492', '5e29335b-526d-4516-b22f-0a4b358fa242', '18cd0bd2-7aad-4340-8c81-9b2e384d73d9', '1ef7ccbc-6790-4479-aa90-c4acb5fc8cc4', '8d2c6d43-6e59-4dcf-9511-70707871aeb1', '58042f85-a7c1-492e-a698-d2655c095424', 'd629bf13-4d8b-4a54-996e-d531306293ea', '79039685-1b02-4aa5-a259-4eb9b8d8a65a', '16ffe6f3-fe82-4610-9ec9-a0a3138313a9', 'a3d9050b-faf2-4fa4-873a-65c81cab4c56']
    Using a mapper:  [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]

    @v.parallel(block=True)
    def f(x): return 2*x

    result = f.map(range(10))
    print("Using a parallel function: ", result)

    Using a parallel function:  [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]