docs: def new(template, target=None, name=None):
      """
      Function for creating a template script or tool.
      
      :param template: template to be used ; one of TEMPLATES
      :param target:   type of script/tool to be created
      :param name:     name of the new script/tool
      """
      if template not in TEMPLATES:
          raise ValueError("Template argument must be one of the followings: {}"
                           .format(", ".join(TEMPLATES)))
      if target is not None and target not in TARGETS.keys():
          raise ValueError("Target argument must be one of the followings: {}"
                           .format(TARGETS.keys()))
      name = name or template
      if NAME_REGEX.match(name) is None:
          raise ValueError("Invalid {} name".format(template))
      with open("{}.py".format(name), 'w') as f:
          target_imp = "" if target is None else "from {} import {}\n" \
                                                 .format(*target.split('.'))
          main = MAIN.format(base=TARGETS.get(target) or "")
          if template == "script":
              f.write(SHEBANG + IMPORTS.format(target=target_imp) + "\n\n" + main)
          elif template == "tool":
              f.write(SHEBANG + TOOL_METADATA + TOOL_SECTIONS \
                      .format(imports=IMPORTS.format(target=target_imp)) + main)