<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def plot(self, qubit_subset=None):
 """ Plots a bar chart with bitstring on the x axis and probability on the y axis. :param list qubit_subset: Optional parameter used for plotting a subset of the Hilbert space. """

        import matplotlib.pyplot as plt
        prob_dict = self.get_outcome_probs()
        if qubit_subset:
            sub_dict = {}
            qubit_num = len(self)
            for i in qubit_subset:
                if i > (2**qubit_num - 1):
                    raise IndexError("Index {} too large for {} qubits.".format(i, qubit_num))
                else:
                    sub_dict[get_bitstring_from_index(i, qubit_num)] = prob_dict[get_bitstring_from_index(i, qubit_num)]
            prob_dict = sub_dict
        plt.bar(range(len(prob_dict)), prob_dict.values(), align='center', color='#6CAFB7')
        plt.xticks(range(len(prob_dict)), prob_dict.keys())
        plt.show()