<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_record_list(db_dir, records='all'):
 """ Get a list of records belonging to a database. Parameters db_dir : str The database directory, usually the same as the database slug. The location to look for a RECORDS file. records : list, optional A Option used when this function acts as a helper function. Leave as default 'all' to get all records. Examples -------- """

    # Full url physiobank database
    db_url = posixpath.join(config.db_index_url, db_dir)

    # Check for a RECORDS file
    if records == 'all':
        response = requests.get(posixpath.join(db_url, 'RECORDS'))
        if response.status_code == 404:
            raise ValueError('The database %s has no WFDB files to download' % db_url)

        # Get each line as a string
        record_list = response.content.decode('ascii').splitlines()
    # Otherwise the records are input manually
    else:
        record_list = records

    return record_list