'Inserts a new instance of ``CredentialProvider`` into the chain that will
be tried before an existing one.'

def insert_before(self, name, credential_provider):

    try:
        offset = [p.METHOD for p in self.providers].index(name)
    except ValueError:
        raise UnknownCredentialError(name=name)
    self.providers.insert(offset, credential_provider)
