def safe_open(filename, *args, **kwargs):
  """Open a file safely, ensuring that its directory exists.

  :API: public
  """
  safe_mkdir_for(filename)
  return open(filename, *args, **kwargs)
def safe_open ( filename , * args , ** kwargs ) : safe_mkdir_for ( filename ) return open ( filename , * args , ** kwargs )
Open a file safely, ensuring that its directory exists.

  :API: public