<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def mongodb_auth_uri(self, hosts):
 """Get a connection string with all info necessary to authenticate."""

        parts = ['mongodb://']
        if self.login:
            parts.append(self.login)
            if self.password:
                parts.append(':' + self.password)
            parts.append('@')
        parts.append(hosts + '/')
        if self.login:
            parts.append('?authSource=' + self.auth_source)
            if self.x509_extra_user:
                parts.append('&authMechanism=MONGODB-X509')
        return ''.join(parts)