<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update_module_file(redbaron_tree, module_path, show_diff=False, dry_run=False):
 """Set show_diff to False to overwrite module_path with a new file generated from ``redbaron_tree``. Returns True if tree is different from source. """

    with tempfile.NamedTemporaryFile() as tmp_file:
        tmp_file.write(redbaron_tree_to_module_str(redbaron_tree))
        tmp_file.seek(0)
        if are_files_equal(module_path, tmp_file.name):
            logging.debug('Source unchanged')
            return False

        logging.debug('Source modified')

        tmp_file.seek(0)
        diff_update_file(module_path, tmp_file.read(), show_diff, dry_run)