def convert_value(self, v):
def stringify(value):<EOL><INDENT>if self.encoding is not None:<EOL><INDENT>encoder = partial(pprint_thing_encoded,<EOL>encoding=self.encoding)<EOL><DEDENT>else:<EOL><INDENT>encoder = pprint_thing<EOL><DEDENT>return encoder(value)<EOL><DEDENT>kind = _ensure_decoded(self.kind)<EOL>meta = _ensure_decoded(self.meta)<EOL>if kind == '<STR_LIT>' or kind == '<STR_LIT>':<EOL><INDENT>if isinstance(v, (int, float)):<EOL><INDENT>v = stringify(v)<EOL><DEDENT>v = _ensure_decoded(v)<EOL>v = Timestamp(v)<EOL>if v.tz is not None:<EOL><INDENT>v = v.tz_convert('<STR_LIT>')<EOL><DEDENT>return TermValue(v, v.value, kind)<EOL><DEDENT>elif kind == '<STR_LIT>' or kind == '<STR_LIT>':<EOL><INDENT>v = Timedelta(v, unit='<STR_LIT:s>').value<EOL>return TermValue(int(v), v, kind)<EOL><DEDENT>elif meta == '<STR_LIT>':<EOL><INDENT>metadata = com.values_from_object(self.metadata)<EOL>result = metadata.searchsorted(v, side='<STR_LIT:left>')<EOL>if not result and v not in metadata:<EOL><INDENT>result = -<NUM_LIT:1><EOL><DEDENT>return TermValue(result, result, '<STR_LIT>')<EOL><DEDENT>elif kind == '<STR_LIT>':<EOL><INDENT>v = int(float(v))<EOL>return TermValue(v, v, kind)<EOL><DEDENT>elif kind == '<STR_LIT:float>':<EOL><INDENT>v = float(v)<EOL>return TermValue(v, v, kind)<EOL><DEDENT>elif kind == '<STR_LIT:bool>':<EOL><INDENT>if isinstance(v, str):<EOL><INDENT>v = not v.strip().lower() in ['<STR_LIT:false>', '<STR_LIT:f>', '<STR_LIT>',<EOL>'<STR_LIT:n>', '<STR_LIT:none>', '<STR_LIT:0>',<EOL>'<STR_LIT>', '<STR_LIT:{}>', '<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>v = bool(v)<EOL><DEDENT>return TermValue(v, v, kind)<EOL><DEDENT>elif isinstance(v, str):<EOL><INDENT>return TermValue(v, stringify(v), '<STR_LIT:string>')<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>"<EOL>.format(v=v, typ=type(v), kind=kind))<EOL><DEDENT>
convert the expression that is in the term to something that is
        accepted by pytables