#NEWLINE# def ratio( value , decimal_places = 0 , failure_string = 'N/A' ) : #NEWLINE# #INDENT# '\n    Converts a floating point value a X:1 ratio.\n    \n    Number of decimal places set by the `precision` kwarg. Default is one.\n    ' #NEWLINE# try : #NEWLINE# #INDENT# f = float ( value ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# return failure_string #NEWLINE# #UNINDENT# return ( _saferound ( f , decimal_places ) + ':1' )