<file_sep>class Instrument:
    """
    Class to create musical instruments
    """

    def __init__(self, price, brand):
        self.price = price
        self.brand = brand

    def __str__(self):
        return f"{self.brand} - {self.price}$"

    def play(self):
        print("playing")

    def keep_in_case(self):
        print("keep in case")

    def tune(self):
        print("tuned")


class Guitar(Instrument):
    """
    Class to create guitar
    """

    def __init__(self, brand):
        super().__init__(200, brand)
        self.state = "new"
        print(f"This is a {self.state} guitar - {self.price}$")


class Piano(Instrument):
    """
    Class to create piano
    """

    def __init__(self, brand):
        super().__init__(1500, brand)
        self.state = "used"
        print(f"This is a {self.state} {brand} piano - {self.price}$")

    def repair_action(self):
        print("Piano refurbished")
<file_sep>from musical_instruments import Guitar, Piano


class FactoryInstrument:
    @staticmethod
    def get_instrument(type, brand):
        if type == "guitar":
            return Guitar(brand)
        elif type == "piano":
            return Piano(brand)
        else:
            return "Invalid type"
<file_sep># factory
Implementation of the factory design pattern
<file_sep>from factory_instruments import FactoryInstrument


def main():
    guitar = FactoryInstrument.get_instrument("guitar", "Gibson L-5 CES")
    piano = FactoryInstrument.get_instrument("piano", "Yamaha DX-7")
    guitar.play()
    piano.repair_action()


main()
