def _value_with_fmt(self, val):
fmt = None<EOL>if is_integer(val):<EOL><INDENT>val = int(val)<EOL><DEDENT>elif is_float(val):<EOL><INDENT>val = float(val)<EOL><DEDENT>elif is_bool(val):<EOL><INDENT>val = bool(val)<EOL><DEDENT>elif isinstance(val, datetime):<EOL><INDENT>fmt = self.datetime_format<EOL><DEDENT>elif isinstance(val, date):<EOL><INDENT>fmt = self.date_format<EOL><DEDENT>elif isinstance(val, timedelta):<EOL><INDENT>val = val.total_seconds() / float(<NUM_LIT>)<EOL>fmt = '<STR_LIT:0>'<EOL><DEDENT>else:<EOL><INDENT>val = compat.to_str(val)<EOL><DEDENT>return val, fmt<EOL>
Convert numpy types to Python types for the Excel writers.

        Parameters
        ----------
        val : object
            Value to be written into cells

        Returns
        -------
        Tuple with the first element being the converted value and the second
            being an optional format