def _is_writable_dir(p):
 try:
  (p + u'')
 except TypeError:
  return False
 if ((not os.access(p, os.W_OK)) or (not os.path.isdir(p))):
  return False
 try:
  t = tempfile.TemporaryFile(dir=p)
  try:
   t.write('1')
  finally:
   t.close()
 except:
  return False
 return True

def _is_writable_dir ( p ) : try : ( p + u'' ) except TypeError : return False if ( ( not os . access ( p , os . W_OK ) ) or ( not os . path . isdir ( p ) ) ) : return False try : t = tempfile . TemporaryFile ( dir = p ) try : t . write ( '1' ) finally : t . close ( ) except : return False return True
p is a string pointing to a putative writable dir -- return true p is such a string .