<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def export_as_file(self, file_path, cv_source):
 """Export the ensemble as a single Python file and saves it to `file_path`. This is EXPERIMENTAL as putting different modules together would probably wreak havoc especially on modules that make heavy use of global variables. Args: file_path (str, unicode):
 Absolute/local path of place to save file in cv_source (str, unicode):
 String containing actual code for base learner cross-validation used to generate secondary meta-features. """

        if os.path.exists(file_path):
            raise exceptions.UserError('{} already exists'.format(file_path))

        with open(file_path, 'wb') as f:
            f.write(self.export_as_code(cv_source).encode('utf8'))