# Buggy code
def store_credentials(credentials, overwrite=False, filename=None):
    """
    Store the credentials for a single account in the configuration file.

    Args:
        credentials (Credentials): credentials instance.
        overwrite (bool): overwrite existing credentials.
        filename (str): full path to the qiskitrc file. If `None`, the default
            location is used (`HOME/.qiskit/qiskitrc`).

    Raises:
        QISKitError: If credentials already exists and overwrite=False; or if
            the account_name could not be assigned.
    """
    # Read the current providers stored in the configuration file.
    filename = filename or DEFAULT_QISKITRC_FILE
    stored_credentials = read_credentials_from_qiskitrc(filename)

    if credentials.unique_id() in stored_credentials and not overwrite:
        raise QISKitError("Credentials already present and overwrite=False")

    # Append and write the credentials to file.
    stored_credentials[credentials.unique_id()] = credentials
    write_qiskit_rc(stored_credentials, filename)


# Traceback (IBMQuantumExperience.IBMQuantumExperience.CredentialsError)
Traceback (most recent call last):
File "/anaconda3/lib/python3.7/site-packages/qiskit/backends/ibmq/ibmqsingleprovider.py", line 71, in _authenticate
credentials.verify)
File "/anaconda3/lib/python3.7/site-packages/IBMQuantumExperience/IBMQuantumExperience.py", line 478, in __init__
self.req = _Request(token, config=config, verify=verify)
File "/anaconda3/lib/python3.7/site-packages/IBMQuantumExperience/IBMQuantumExperience.py", line 253, in __init__
ntlm_credentials=self.ntlm_credentials)
File "/anaconda3/lib/python3.7/site-packages/IBMQuantumExperience/IBMQuantumExperience.py", line 95, in __init__
self.obtain_token(config=self.config)
File "/anaconda3/lib/python3.7/site-packages/IBMQuantumExperience/IBMQuantumExperience.py", line 159, in obtain_token
raise CredentialsError('error during login: %s' % error_message)
IBMQuantumExperience.IBMQuantumExperience.CredentialsError: error during login: Wrong user or password, check your credentials.

# Fixed code
def store_credentials(credentials, overwrite=False, filename=None):
    """
    Store the credentials for a single account in the configuration file.

    Args:
        credentials (Credentials): credentials instance.
        overwrite (bool): overwrite existing credentials.
        filename (str): full path to the qiskitrc file. If `None`, the default
            location is used (`HOME/.qiskit/qiskitrc`).

    Raises:
        QISKitError: if the account_name could not be assigned.
    """
    # Read the current providers stored in the configuration file.
    filename = filename or DEFAULT_QISKITRC_FILE
    stored_credentials = read_credentials_from_qiskitrc(filename)

    # Check if duplicated credentials are already stored. By convention,
    # we assume (hub, group, project) is always unique.
    if credentials.unique_id() in stored_credentials and not overwrite:
        warnings.warn("Credentials already present. Set overwrite=True to overwrite.")
        return

    # Append and write the credentials to file.
    stored_credentials[credentials.unique_id()] = credentials
    write_qiskit_rc(stored_credentials, filename)