docs: def get_cardinality(self, variables):
          """
          Returns cardinality of a given variable
  
          Parameters
          ----------
          variables: list, array-like
                  A list of variable names.
  
          Returns
          -------
          dict: Dictionary of the form {variable: variable_cardinality}
  
          Examples
          --------
          >>> from pgmpy.factors.discrete import DiscreteFactor
          >>> phi = DiscreteFactor(['x1', 'x2', 'x3'], [2, 3, 2], range(12))
          >>> phi.get_cardinality(['x1'])
          {'x1': 2}
          >>> phi.get_cardinality(['x1', 'x2'])
          {'x1': 2, 'x2': 3}
          """
          if isinstance(variables, six.string_types):
              raise TypeError("variables: Expected type list or array-like, got type str")
  
          if not all([var in self.variables for var in variables]):
              raise ValueError("Variable not in scope")
  
          return {var: self.cardinality[self.variables.index(var)] for var in variables}