title: Check if I can write a file to a directory or not with Python
body: <p>I need to check if I can write a file to a directory that user point to with Python.</p>
  
  <p>Is there an way to check it in advance? I may be using try .. catch for this purpose, but I expect something better in the sense that I can check in advance. </p>