code: def load_external_components(typesys):
      
  
      # Find all of the registered IOTile components and see if we need to add any type libraries for them
      from iotile.core.dev.registry import ComponentRegistry
  
      reg = ComponentRegistry()
      modules = reg.list_components()
  
      typelibs = reduce(lambda x, y: x+y, [reg.find_component(x).find_products('type_package') for x in modules], [])
      for lib in typelibs:
          if lib.endswith('.py'):
              lib = lib[:-3]
  
          typesys.load_external_types(lib)
docs: Load all external types defined by iotile plugins.
  
      This allows plugins to register their own types for type annotations and
      allows all registered iotile components that have associated type libraries to
      add themselves to the global type system.