code: def format_node(node, format="python", include_config=False):
      """Format a node in a given output syntax."""
      from .nodes import MapNode
  
      lines = []
      name = node.fullname.replace(".", "_")
      if format == "python":
          klass = node.interface
          importline = f"from {klass.__module__} import {klass.__class__.__name__}"
          comment = "# Node: %s" % node.fullname
          spec = signature(node.interface.__init__)
          filled_args = []
          for param in spec.parameters.values():
              val = getattr(node.interface, f"_{param.name}", None)
              if val is not None:
                  filled_args.append(f"{param.name}={val!r}")
          args = ", ".join(filled_args)
          klass_name = klass.__class__.__name__
          if isinstance(node, MapNode):
              nodedef = '{} = MapNode({}({}), iterfield={}, name="{}")'.format(
                  name,
                  klass_name,
                  args,
                  node.iterfield,
                  name,
              )
          else:
              nodedef = (
                  f'{name} = Node({klass_name}({args}), name="{name}")'
              )
          lines = [importline, comment, nodedef]
  
          if include_config:
              lines = [
                  importline,
                  "from collections import OrderedDict",
                  comment,
                  nodedef,
              ]
              lines.append(f"{name}.config = {node.config}")
  
          if node.iterables is not None:
              lines.append(f"{name}.iterables = {node.iterables}")
          lines.extend(_write_inputs(node))
  
      return lines
  
imports: import os
  import sys
  import pickle
  from collections import defaultdict
  import re
  from copy import deepcopy
  from glob import glob
  from pathlib import Path
  from traceback import format_exception
  from hashlib import sha1
  from functools import reduce
  import numpy
  from ...None import logging, config
  from ...utils.filemanip import indirectory, relpath, fname_presuffix, ensure_list, get_related_files, save_json, savepkl, loadpkl, write_rst_header, write_rst_dict, write_rst_list
  from ...utils.misc import str2bool
  from ...utils.functions import create_function_from_source
  from ...interfaces.base.traits_extension import rebase_path_traits, resolve_path_traits, OutputMultiPath, isdefined, Undefined
  from ...interfaces.base.support import Bunch, InterfaceResult
  from ...interfaces.base import CommandLine
  from ...interfaces.utility import IdentityInterface
  from ...utils.provenance import ProvStore, pm, nipype_ns, get_id
  from inspect import signature
label_desc: Use image node_id 10 for calling a global function with example usage: format_node(node, format, include_config) and returns: lines