code: def pydeps(**args):
      
      _args = args if args else cli.parse_args(sys.argv[1:])
      inp = target.Target(_args['fname'])
      log.debug("Target: %r", inp)
  
      if _args.get('output'):
          _args['output'] = os.path.abspath(_args['output'])
      else:
          _args['output'] = os.path.join(
              inp.calling_dir,
              inp.modpath.replace('.', '_') + '.' + _args.get('format', 'svg')
          )
  
      with inp.chdir_work():
          _args['fname'] = inp.fname
          _args['isdir'] = inp.is_dir
  
          if _args.get('externals'):
              del _args['fname']
              exts = externals(inp, **_args)
              print(json.dumps(exts, indent=4))
              return exts  # so the tests can assert
          else:
              # this is the call you're looking for :-)
              return _pydeps(inp, **_args)
docs: Entry point for the ``pydeps`` command.
  
         This function should do all the initial parameter and environment
         munging before calling ``_pydeps`` (so that function has a clean
         execution path).