'If field exists return trueval or the field (default)
otherwise, emit return falseval (if provided).
:param field: The name of the field
:param trueval: The string if the condition is true
:param falseval: The string if the condition is false
:return: The string, based on condition'

def tmpl_ifdef(self, field, trueval=u'', falseval=u''):

    if self.item.formatted().get(field):
        return (trueval if trueval else self.item.formatted().get(field))
    else:
        return falseval
