def do_default(value, default_value=u'', boolean=False):
 if ((boolean and (not value)) or isinstance(value, Undefined)):
  return default_value
 return value

def do_default ( value , default_value = u'' , boolean = False ) : if ( ( boolean and ( not value ) ) or isinstance ( value , Undefined ) ) : return default_value return value
if the value is undefined it will return the passed default value .