code: def get_module_members(module, type=None):
      
  
      # if module argument is a string, try to load the module with the
      # specified name
      if isinstance(module, str):
          module = importlib.import_module(module)
  
      # Get members in the module
      members = map(lambda x: x[1], inspect.getmembers(module, type))
  
      # Filter out members that are not defined in the specified module
      # or a submodule thereof
      members = filter(lambda x: module.__name__ in _member_module_name(x),
                       members)
  
      if hasattr(module, '__all__'):
          # If the module has an __all__ attribute, sort the members in the
          # same order as the entries in __all__, and filter out members
          # that are not listed in __all__. The slemap parameter of
          # sort_by_list_order is needed because the list to be sorted
          # consist of module member ojects, while __all__ is a list of
          # module name strings.
          members = sort_by_list_order(members, getattr(module, '__all__'),
                                       fltr=True, slemap=lambda x: x.__name__)
      else:
          # If the module does not have an __all__ attribute, attempt to
          # sort the members in the order in which they are defined in the
          # source file(s)
          members = sorted(members, key=_member_sort_key)
  
      return members
docs: Get a list of module member objects, excluding members that are
      imported from other modules that are not submodules of the specified
      moodule. An attempt is made to sort the list in order of definition
      in the source file. If the module has an `__all__` attribute, the
      list is sorted in the same order, and members that are not in the
      list are filtered out.
  
      Parameters
      ----------
      module : string or module object
        Module for which member list is to be generated
      type : inspect predicate function (e.g. inspect.isfunction) or None
        Restrict returned members to specified type
  
      Returns
      -------
      mbrlst : list
        List of module members