<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_organizations(self, outfile):
 """Export organizations information to a file. The method exports information related to organizations, to the given 'outfile' output file. :param outfile: destination file object """

        exporter = SortingHatOrganizationsExporter(self.db)

        dump = exporter.export()

        try:
            outfile.write(dump)
            outfile.write('\n')
        except IOError as e:
            raise RuntimeError(str(e))

        return CMD_SUCCESS