<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def safe_file_dump(filename, payload='', mode='w'):
 """Write a string to a file. This method is "safe" to the extent that `safe_open` is "safe". See the explanation on the method doc there. When `payload` is an empty string (the default), this method can be used as a concise way to create an empty file along with its containing directory (or truncate it if it already exists). :param string filename: The filename of the file to write to. :param string payload: The string to write to the file. :param string mode: A mode argument for the python `open` builtin which should be a write mode variant. Defaults to 'w'. """

  with safe_open(filename, mode=mode) as f:
    f.write(payload)