def localised_filesize(number):
 def rnd(number, divisor):
  return localised_number((float(((number * 10) / divisor)) / 10))
 if (number < 1024):
  return _('{bytes} bytes').format(bytes=localised_number(number))
 elif (number < (1024 ** 2)):
  return _('{kibibytes} KiB').format(kibibytes=rnd(number, 1024))
 elif (number < (1024 ** 3)):
  return _('{mebibytes} MiB').format(mebibytes=rnd(number, (1024 ** 2)))
 elif (number < (1024 ** 4)):
  return _('{gibibytes} GiB').format(gibibytes=rnd(number, (1024 ** 3)))
 else:
  return _('{tebibytes} TiB').format(tebibytes=rnd(number, (1024 ** 4)))

def localised_filesize ( number ) : def rnd ( number , divisor ) : return localised_number ( ( float ( ( ( number * 10 ) / divisor ) ) / 10 ) ) if ( number < 1024 ) : return _ ( '{bytes} bytes' ) . format ( bytes = localised_number ( number ) ) elif ( number < ( 1024 ** 2 ) ) : return _ ( '{kibibytes} KiB' ) . format ( kibibytes = rnd ( number , 1024 ) ) elif ( number < ( 1024 ** 3 ) ) : return _ ( '{mebibytes} MiB' ) . format ( mebibytes = rnd ( number , ( 1024 ** 2 ) ) ) elif ( number < ( 1024 ** 4 ) ) : return _ ( '{gibibytes} GiB' ) . format ( gibibytes = rnd ( number , ( 1024 ** 3 ) ) ) else : return _ ( '{tebibytes} TiB' ) . format ( tebibytes = rnd ( number , ( 1024 ** 4 ) ) )
returns a localised unicode representation of a number in bytes .