docs: def normalize(self, inplace=True):
          """
          Normalizes the values of factor so that they sum to 1.
  
          Parameters
          ----------
          inplace: boolean
              If inplace=True it will modify the factor itself, else would return
              a new factor
  
          Returns
          -------
          DiscreteFactor or None: if inplace=True (default) returns None
                          if inplace=False returns a new `DiscreteFactor` instance.
  
          Examples
          --------
          >>> from pgmpy.factors.discrete import DiscreteFactor
          >>> phi = DiscreteFactor(['x1', 'x2', 'x3'], [2, 3, 2], range(12))
          >>> phi.values
          array([[[ 0,  1],
                  [ 2,  3],
                  [ 4,  5]],
  
                 [[ 6,  7],
                  [ 8,  9],
                  [10, 11]]])
          >>> phi.normalize()
          >>> phi.variables
          ['x1', 'x2', 'x3']
          >>> phi.cardinality
          array([2, 3, 2])
          >>> phi.values
          array([[[ 0.        ,  0.01515152],
                  [ 0.03030303,  0.04545455],
                  [ 0.06060606,  0.07575758]],
  
                 [[ 0.09090909,  0.10606061],
                  [ 0.12121212,  0.13636364],
                  [ 0.15151515,  0.16666667]]])
  
          """
          phi = self if inplace else self.copy()
  
          phi.values = phi.values / phi.values.sum()
  
          if not inplace:
              return phi