def _extract_tempfile_directory(self, config_temp_dir=None):
<EOL>securesystemslib.settings.temporary_directory = config_temp_dir<EOL>if config_temp_dir is None:<EOL><INDENT>config_temp_dir = tempfile.gettempdir()<EOL><DEDENT>saved_tempfile_TemporaryFile = securesystemslib.util.tempfile.NamedTemporaryFile<EOL>securesystemslib.util.tempfile.NamedTemporaryFile = tempfile.mkstemp<EOL>_temp_fileobj = securesystemslib.util.TempFile()<EOL>securesystemslib.util.tempfile.NamedTemporaryFile = saved_tempfile_TemporaryFile<EOL>junk, _tempfilepath = _temp_fileobj.temporary_file<EOL>_tempfile_dir = os.path.dirname(_tempfilepath)<EOL>if os.path.exists(_tempfilepath):<EOL><INDENT>os.remove(_tempfilepath)<EOL><DEDENT>return config_temp_dir, _tempfile_dir<EOL>
Takes a directory (essentially specified in the settings.py as
'temporary_directory') and substitutes tempfile.TemporaryFile() with
tempfile.mkstemp() in order to extract actual directory of the stored
tempfile.  Returns the config's temporary directory (or default temp
directory) and actual directory.