def externals(trgt, **kwargs):
kw = dict(<EOL>T='<STR_LIT>', config=None, debug=False, display=None, exclude=[], externals=True,<EOL>format='<STR_LIT>', max_bacon=<NUM_LIT:2>**<NUM_LIT>, no_config=True, nodot=False,<EOL>noise_level=<NUM_LIT:2>**<NUM_LIT>, noshow=True, output=None, pylib=True, pylib_all=True,<EOL>show=False, show_cycles=False, show_deps=False, show_dot=False,<EOL>show_raw_deps=False, verbose=<NUM_LIT:0>, include_missing=True,<EOL>)<EOL>kw.update(kwargs)<EOL>depgraph = py2depgraph.py2dep(trgt, **kw)<EOL>pkgname = trgt.fname<EOL>log.info("<STR_LIT>", depgraph)<EOL>pkgname = os.path.splitext(pkgname)[<NUM_LIT:0>]<EOL>res = {}<EOL>ext = set()<EOL>for k, src in list(depgraph.sources.items()):<EOL><INDENT>if k.startswith('<STR_LIT:_>'):<EOL><INDENT>continue<EOL><DEDENT>if not k.startswith(pkgname):<EOL><INDENT>continue<EOL><DEDENT>if src.imports:<EOL><INDENT>imps = [imp for imp in src.imports if not imp.startswith(pkgname)]<EOL>if imps:<EOL><INDENT>for imp in imps:<EOL><INDENT>ext.add(imp.split('<STR_LIT:.>')[<NUM_LIT:0>])<EOL><DEDENT>res[k] = imps<EOL><DEDENT><DEDENT><DEDENT>return list(sorted(ext))<EOL>
Return a list of direct external dependencies of ``pkgname``.
       Called for the ``pydeps --externals`` command.