<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def save_credentials(self, profile="default"):
 """ Save your database credentials so you don't have to save them in script. Parameters profile: str (optional) identifier/name for your database (i.e. "dw", "prod") from db import DB import pymysql db = DB(username="hank", password="foo", hostname="prod.mardukas.com", dbname="bar", dbtype="mysql") db.save_credentials(profile="production") db = DB(username="hank", password="foo", hostname="staging.mardukas.com", dbname="bar", dbtype="mysql") db.save_credentials(profile="staging") db = DB(profile="staging") """

        f = profile_path(DBPY_PROFILE_ID, profile)
        dump_to_json(f, self.credentials)