def validate_overlap_for(doc, doctype, fieldname, value=None):
 existing = get_overlap_for(doc, doctype, fieldname, value)
 if existing:
  frappe.throw(_(u'This {0} conflicts with {1} for {2} {3}').format(doc.doctype, existing.name, (doc.meta.get_label(fieldname) if (not value) else fieldname), (value or doc.get(fieldname))), OverlapError)

def validate_overlap_for ( doc , doctype , fieldname , value = None ) : existing = get_overlap_for ( doc , doctype , fieldname , value ) if existing : frappe . throw ( _ ( u'This {0} conflicts with {1} for {2} {3}' ) . format ( doc . doctype , existing . name , ( doc . meta . get_label ( fieldname ) if ( not value ) else fieldname ) , ( value or doc . get ( fieldname ) ) ) , OverlapError )
checks overlap for specified feild .