def METHOD_NAME(email, token, token_type='Token', api_host=None):
    api_host = api_host or solvebio.api_host
    try:
        netrc_path = netrc.path()
        rc = netrc(netrc_path)
    except (IOError, TypeError, NetrcParseError) as e:
        raise CredentialsError('Could not open netrc file: ' + str(e))
    # Overwrites any existing credentials
    rc.hosts[as_netrc_machine(api_host)] = (email, token_type, token)
    rc.save(netrc_path)