code: def apply_patch(self, patch):
          
  
          history_file = File(self.__history_file)
          patches_history = history_file.cache() and [line.strip() for line in history_file.content] or []
  
          if patch.uid not in patches_history:
              LOGGER.debug("> Applying '{0}' patch!".format(patch.name))
              if patch.apply():
                  history_file.content = ["{0}\n".format(patch.uid)]
                  history_file.append()
              else:
                  raise umbra.exceptions.PatchApplyError("{0} | '{1}' patch failed to apply!".format(
                      self.__class__.__name__, patch.path))
          else:
              LOGGER.debug("> '{0}' patch is already applied!".format(patch.name))
          return True
docs: Applies given patch.
  
          :param patch: Patch.
          :type patch: Patch
          :return: Method success.
          :rtype: bool