<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def __blackpkg(self, bl, repo, pkg):
 """Add packages in blacklist """

        if bl.startswith("*") and bl.endswith("*"):
            if bl[1:-1] in pkg:
                self.black.append(self.__add(repo, pkg))
        elif bl.endswith("*"):
            if pkg.startswith(bl[:-1]):
                self.black.append(self.__add(repo, pkg))
        elif bl.startswith("*"):
            if pkg.endswith(bl[1:]):
                self.black.append(self.__add(repo, pkg))
        if bl not in self.black and "*" not in bl:
            self.black.append(bl)