class WeirdCreatureException (BaseException):
    pass

class WeirdNrOfLegsException (WeirdCreatureException):
    def __init__ (self, nrOfLegs):
        self.nrOfLegs = nrOfLegs

    def __str__ (self):
        return f'Nr of legs {self.nrOfLegs}'

class WeirdColorException (WeirdCreatureException):
    def __init__ (self, color):
        self.color = color

    def __str__ (self):
        return f'Color: {self.color}'

class Alligator:
    def __init__ (self, nrOfLegs, color):
        self.nrOfLegs = nrOfLegs
        self.color = color

    def check (self):
        if self.nrOfLegs != 4:
            raise WeirdNrOfLegsException (self.nrOfLegs)

        if not self.color in ('green', 'brown'):
            raise WeirdColorException (self.color)

for alligator in (
    Alligator (4, 'green'),
    Alligator (5, 'brown'),
    Alligator (4, 'pink')
):
    try:
        alligator.check ()
    except WeirdColorException as exception:
        print (111, exception)
#    except WeirdNrOfLegsException as exception:
#        print (222, exception)
    except WeirdCreatureException as exception:
        print (333, exception)
