<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def register_patch(self, name, path):
 """ Registers given patch. :param name: Patch name. :type name: unicode :param path: Patch path. :type path: unicode :return: Method success. :rtype: bool """


        patch = foundations.strings.get_splitext_basename(path)
        LOGGER.debug("> Current patch: '{0}'.".format(patch))

        directory = os.path.dirname(path)
        not directory in sys.path and sys.path.append(directory)

        module = __import__(patch)
        if hasattr(module, "apply") and hasattr(module, "UID"):
            self.__patches[name] = Patch(name=name,
                                         path=path,
                                         module=module,
                                         apply=getattr(module, "apply"),
                                         uid=getattr(module, "UID"))
        else:
            raise umbra.exceptions.PatchInterfaceError(
                "{0} | '{1}' is not a valid patch and has been rejected!".format(self.__class__.__name__, patch))
        return True