<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def replace_heroku_db(self, file_url):
 """ Replace Heroku database with database from specified source. """

        self.print_message("Replacing database for Heroku app '%s'" % self.args.destination_app)

        self.reset_heroku_database()

        if file_url:
            self.print_message("Restoring from URL '%s'" % file_url)
            args = [
                "heroku",
                "pg:backups:restore",
                file_url,
                "--app=%s" % self.args.destination_app,
                "DATABASE",
                "--confirm",
                self.args.destination_app,
            ]
            if self.args.use_pgbackups:
                args = [
                    "heroku",
                    "pgbackups:restore",
                    "--app=%s" % self.args.destination_app,
                    "DATABASE_URL",
                    "--confirm",
                    self.args.destination_app,
                    file_url,
                ]
            subprocess.check_call(args)
        else:
            # TODO perhaps add support for file -> heroku by piping to pg:psql
            self.print_message("Pushing data from database '%s'" % self.databases['source']['name'])
            self.print_message("NOTE: Any postgres authentication settings you passed to paragres "
                               "will be ignored.\nIf desired, you can export PG* variables.\n"
                               "You will be prompted for your psql password.")
            args = [
                "heroku",
                "pg:push",
                self.databases['source']['name'],
                "DATABASE_URL",
                "--app=%s" % self.args.destination_app,
            ]
            subprocess.check_call(args)