Returns a copy of the model.

        Returns
        -------
        BayesianModel: Copy of the model on which the method was called.

        Examples
        --------
        >>> from pgmpy.models import BayesianModel
        >>> from pgmpy.factors.discrete import TabularCPD
        >>> model = BayesianModel([('A', 'B'), ('B', 'C')])
        >>> cpd_a = TabularCPD('A', 2, [[0.2], [0.8]])
        >>> cpd_b = TabularCPD('B', 2, [[0.3, 0.7], [0.7, 0.3]],
                               evidence=['A'],
                               evidence_card=[2])
        >>> cpd_c = TabularCPD('C', 2, [[0.1, 0.9], [0.9, 0.1]],
                               evidence=['B'],
                               evidence_card=[2])
        >>> model.add_cpds(cpd_a, cpd_b, cpd_c)
        >>> copy_model = model.copy()
        >>> copy_model.nodes()
        ['C', 'A', 'B']
        >>> copy_model.edges()
        [('A', 'B'), ('B', 'C')]
        >>> copy_model.get_cpds()
        [<TabularCPD representing P(A:2) at 0x7f2824930a58>,
         <TabularCPD representing P(B:2 | A:2) at 0x7f2824930a90>,
         <TabularCPD representing P(C:2 | B:2) at 0x7f2824944240>]

def copy(self):
        """
        Returns a copy of the model.

        Returns
        -------
        BayesianModel: Copy of the model on which the method was called.

        Examples
        --------
        >>> from pgmpy.models import BayesianModel
        >>> from pgmpy.factors.discrete import TabularCPD
        >>> model = BayesianModel([('A', 'B'), ('B', 'C')])
        >>> cpd_a = TabularCPD('A', 2, [[0.2], [0.8]])
        >>> cpd_b = TabularCPD('B', 2, [[0.3, 0.7], [0.7, 0.3]],
                               evidence=['A'],
                               evidence_card=[2])
        >>> cpd_c = TabularCPD('C', 2, [[0.1, 0.9], [0.9, 0.1]],
                               evidence=['B'],
                               evidence_card=[2])
        >>> model.add_cpds(cpd_a, cpd_b, cpd_c)
        >>> copy_model = model.copy()
        >>> copy_model.nodes()
        ['C', 'A', 'B']
        >>> copy_model.edges()
        [('A', 'B'), ('B', 'C')]
        >>> copy_model.get_cpds()
        [<TabularCPD representing P(A:2) at 0x7f2824930a58>,
         <TabularCPD representing P(B:2 | A:2) at 0x7f2824930a90>,
         <TabularCPD representing P(C:2 | B:2) at 0x7f2824944240>]
        """
        model_copy = BayesianModel()
        model_copy.add_nodes_from(self.nodes())
        model_copy.add_edges_from(self.edges())
        if self.cpds:
            model_copy.add_cpds(*[cpd.copy() for cpd in self.cpds])
        return model_copy