<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def imported_from_bootstrap(self, module):
 """Return ``True`` if the given ``module`` object was imported from bootstrap code. :param module: The module to check the provenance of. :type module: :class:`types.ModuleType` :rtype: bool """


    # A vendored module.
    path = getattr(module, '__file__', None)
    if path and os.path.realpath(path).startswith(self._realpath):
      return True

    # A vendored package.
    path = getattr(module, '__path__', None)
    if path and any(os.path.realpath(path_item).startswith(self._realpath)
                    for path_item in path):
      return True

    return False