def maybe_coerce_with(converter, obj, **kwargs):
    'Apply converter if str, pass through otherwise.'
    obj = getattr(obj, 'original_object', obj)
    return (converter(obj, **kwargs) if isinstance(obj, str) else obj)
Apply converter if str, pass through otherwise.
def maybe_coerce_with(converter, obj, **kwargs):
    
    obj = getattr(obj, 'original_object', obj)
    return (converter(obj, **kwargs) if isinstance(obj, str) else obj)