def downcast(self, dtypes=None):
<EOL>if dtypes is False:<EOL><INDENT>return self<EOL><DEDENT>values = self.values<EOL>if self._is_single_block:<EOL><INDENT>if dtypes is None:<EOL><INDENT>dtypes = '<STR_LIT>'<EOL><DEDENT>nv = maybe_downcast_to_dtype(values, dtypes)<EOL>return self.make_block(nv)<EOL><DEDENT>if dtypes is None:<EOL><INDENT>return self<EOL><DEDENT>if not (dtypes == '<STR_LIT>' or isinstance(dtypes, dict)):<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>def f(m, v, i):<EOL><INDENT>if dtypes == '<STR_LIT>':<EOL><INDENT>dtype = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>raise AssertionError("<STR_LIT>")<EOL><DEDENT>if dtype is not None:<EOL><INDENT>v = maybe_downcast_to_dtype(v, dtype)<EOL><DEDENT>return v<EOL><DEDENT>return self.split_and_operate(None, f, False)<EOL>
try to downcast each item to the dict of dtypes if present