#NEWLINE# def format_length( num_metres , keep_width = False ) : #NEWLINE# #INDENT# "\n    Format a metre count as a human readable length.\n\n    :param num_metres: The length to format in metres (float / integer).\n    :param keep_width: ``True`` if trailing zeros should not be stripped,\n                       ``False`` if they can be stripped.\n    :returns: The corresponding human readable length (a string).\n\n    This function supports ranges from nanometres to kilometres.\n\n    Some examples:\n\n    >>> from humanfriendly import format_length\n    >>> format_length(0)\n    '0 metres'\n    >>> format_length(1)\n    '1 metre'\n    >>> format_length(5)\n    '5 metres'\n    >>> format_length(1000)\n    '1 km'\n    >>> format_length(0.004)\n    '4 mm'\n    " #NEWLINE# for unit in reversed ( length_size_units ) : #NEWLINE# #INDENT# if ( num_metres >= unit [ 'divider' ] ) : #NEWLINE# #INDENT# number = round_number ( ( float ( num_metres ) / unit [ 'divider' ] ) , keep_width = keep_width ) #NEWLINE# return pluralize ( number , unit [ 'singular' ] , unit [ 'plural' ] ) #NEWLINE# #UNINDENT# #UNINDENT# return pluralize ( num_metres , 'metre' )