'Check that value of fieldname should be \'condition\' val2
else throw Exception.'

def validate_value(self, fieldname, condition, val2, doc=None, raise_exception=None):

    error_condition_map = {u'in': _(u'one    of'), u'not    in': _(u'none    of'), u'^': _(u'beginning    with')}
    if (not doc):
        doc = self
    val1 = doc.get_value(fieldname)
    df = doc.meta.get_field(fieldname)
    val2 = doc.cast(val2, df)
    if (not frappe.compare(val1, condition, val2)):
        label = doc.meta.get_label(fieldname)
        condition_str = error_condition_map.get(condition, condition)
        if doc.parentfield:
            msg = _(u'Incorrect    value    in    row    {0}:    {1}    must    be    {2}    {3}'.format(doc.idx, label, condition_str, val2))
        else:
            msg = _(u'Incorrect    value:    {0}    must    be    {1}    {2}'.format(label, condition_str, val2))
        msgprint(msg, raise_exception=(raise_exception or True))
