def get_avg_purchase_rate(serial_nos):
 serial_nos = get_valid_serial_nos(serial_nos)
 return flt(frappe.db.sql((u'select avg(purchase_rate) from `tabSerial No`\n DCTB  DCTB where name in (%s)' % u', '.join(([u'%s'] * len(serial_nos)))), tuple(serial_nos))[0][0])

def get_avg_purchase_rate ( serial_nos ) : serial_nos = get_valid_serial_nos ( serial_nos ) return flt ( frappe . db . sql ( ( u'select avg(purchase_rate) from `tabSerial No`\n DCTB  DCTB where name in (%s)' % u', ' . join ( ( [ u'%s' ] * len ( serial_nos ) ) ) ) , tuple ( serial_nos ) ) [ 0 ] [ 0 ] )
get average value of serial numbers .