<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_dbinstance(self, id, allocated_storage, instance_class, master_username, master_password, port=3306, engine='MySQL5.1', db_name=None, param_group=None, security_groups=None, availability_zone=None, preferred_maintenance_window=None, backup_retention_period=None, preferred_backup_window=None, multi_az=False, engine_version=None, auto_minor_version_upgrade=True):
 """ Create a new DBInstance. :type id: str :param id: Unique identifier for the new instance. Must contain 1-63 alphanumeric characters. First character must be a letter. May not end with a hyphen or contain two consecutive hyphens :type allocated_storage: int :param allocated_storage: Initially allocated storage size, in GBs. Valid values are [5-1024] :type instance_class: str :param instance_class: The compute and memory capacity of the DBInstance. Valid values are: * db.m1.small * db.m1.large * db.m1.xlarge * db.m2.xlarge * db.m2.2xlarge * db.m2.4xlarge :type engine: str :param engine: Name of database engine. Must be MySQL5.1 for now. :type master_username: str :param master_username: Name of master user for the DBInstance. Must be 1-15 alphanumeric characters, first must be a letter. :type master_password: str :param master_password: Password of master user for the DBInstance. Must be 4-16 alphanumeric characters. :type port: int :param port: Port number on which database accepts connections. Valid values [1115-65535]. Defaults to 3306. :type db_name: str :param db_name: Name of a database to create when the DBInstance is created. Default is to create no databases. :type param_group: str :param param_group: Name of DBParameterGroup to associate with this DBInstance. If no groups are specified no parameter groups will be used. :type security_groups: list of str or list of DBSecurityGroup objects :param security_groups: List of names of DBSecurityGroup to authorize on this DBInstance. :type availability_zone: str :param availability_zone: Name of the availability zone to place DBInstance into. :type preferred_maintenance_window: str :param preferred_maintenance_window: The weekly time range (in UTC) during which maintenance can occur. Default is Sun:05:00-Sun:09:00 :type backup_retention_period: int :param backup_retention_period: The number of days for which automated backups are retained. Setting this to zero disables automated backups. :type preferred_backup_window: str :param preferred_backup_window: The daily time range during which automated backups are created (if enabled). Must be in h24:mi-hh24:mi format (UTC). :type multi_az: bool :param multi_az: If True, specifies the DB Instance will be deployed in multiple availability zones. :type engine_version: str :param engine_version: Version number of the database engine to use. :type auto_minor_version_upgrade: bool :param auto_minor_version_upgrade: Indicates that minor engine upgrades will be applied automatically to the Read Replica during the maintenance window. Default is True. :rtype: :class:`boto.rds.dbinstance.DBInstance` :return: The new db instance. """

        params = {'DBInstanceIdentifier': id,
                  'AllocatedStorage': allocated_storage,
                  'DBInstanceClass': instance_class,
                  'Engine': engine,
                  'MasterUsername': master_username,
                  'MasterUserPassword': master_password,
                  'Port': port,
                  'MultiAZ': str(multi_az).lower(),
                  'AutoMinorVersionUpgrade':
                      str(auto_minor_version_upgrade).lower()}
        if db_name:
            params['DBName'] = db_name
        if param_group:
            params['DBParameterGroupName'] = param_group
        if security_groups:
            l = []
            for group in security_groups:
                if isinstance(group, DBSecurityGroup):
                    l.append(group.name)
                else:
                    l.append(group)
            self.build_list_params(params, l, 'DBSecurityGroups.member')
        if availability_zone:
            params['AvailabilityZone'] = availability_zone
        if preferred_maintenance_window:
            params['PreferredMaintenanceWindow'] = preferred_maintenance_window
        if backup_retention_period is not None:
            params['BackupRetentionPeriod'] = backup_retention_period
        if preferred_backup_window:
            params['PreferredBackupWindow'] = preferred_backup_window
        if engine_version:
            params['EngineVersion'] = engine_version

        return self.get_object('CreateDBInstance', params, DBInstance)