<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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 -------- {'x1': 2} {'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}