def save_image_main():

    def usage(progname):
        sys.stdout.write("%s -i <node_id> -n <image_name> [-p <profile]\n\n" % progname)

    profile = 'default'
    name = node_id = None

    try:
        opts, args = getopt.getopt(sys.argv[1:], "i:n:p:")
    except getopt.GetoptError, err:
        sys.stderr.write("%s\n" % str(err))
        sys.exit(1)

    for o, a in opts:
        if o == "-i":
            node_id = a
        if o == "-n":
            name = a
        if o == "-p":
            profile = a

    if node_id is None or name is None:
        usage(sys.argv[0])
        sys.exit(1)

    conn = get_lc(profile)

    node = get_node_or_fail(conn, node_id, print_error_and_exit, 
            ("Error: cannot find node with id '%s'." % node_id,))

    Printer.do(conn.ex_save_image(node, name))
Shortcut for main() routine for provider
dataset/ETHPy150Open novel/lc-tools/lctools/shortcuts.py/save_image_main