def forgiving_round(value, precision=0):
 try:
  value = round(float(value), precision)
  return (int(value) if (precision == 0) else value)
 except (ValueError, TypeError):
  return value

def forgiving_round ( value , precision = 0 ) : try : value = round ( float ( value ) , precision ) return ( int ( value ) if ( precision == 0 ) else value ) except ( ValueError , TypeError ) : return value
rounding filter that accepts strings .