title: Better way to convert file sizes in Python
body: <p>I am using a library that reads a file and returns its size in bytes.</p>
  
  <p>This file size is then displayed to the end user; to make it easier for them to understand it, I am explicitly converting the file size to <code>MB</code> by dividing it by <code>1024.0 * 1024.0</code>. Of course this works, but I am wondering is there a better way to do this in Python?</p>
  
  <p>By better, I mean perhaps a stdlib function that can manipulate sizes according to the type I want. Like if I specify <code>MB</code>, it automatically divides it by <code>1024.0 * 1024.0</code>. Somethign on these lines.</p>