<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_db_arguments(parser, db_option=False):
 """Adds common arguments for the database sub-commands to `parser`. `db_option` provides a means to work around https://bugs.python.org/issue9338 whereby a positional argument that follows an optional argument with nargs='+' will not be recognised. When `db_optional` is True, create the database argument as a required optional argument, rather than a positional argument. """

    parser.add_argument('-m', '--memory', action='store_true',
                        help=constants.DB_MEMORY_HELP)
    parser.add_argument('-r', '--ram', default=3, help=constants.DB_RAM_HELP,
                        type=int)
    if db_option:
        parser.add_argument('-d', '--db', help=constants.DB_DATABASE_HELP,
                            metavar='DATABASE', required=True)
    else:
        parser.add_argument('db', help=constants.DB_DATABASE_HELP,
                            metavar='DATABASE')