title: How to determine if data is valid tar file without a file?
body: <p>My upload form expects a tar file and I want to check whether the uploaded data is valid. The <a href="http://docs.python.org/library/tarfile.html" rel="noreferrer">tarfile</a> module supports <a href="https://docs.python.org/2/library/tarfile.html#tarfile.is_tarfile" rel="noreferrer"><code>is_tarfile()</code></a>, but expects a filename - I don't want to waste resources writing the file to disk just to check if it is valid. </p>
  
  <p>Is there a way to check the data is a valid tar file without writing to disk, using standard Python libraries?</p>