<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _getAuthenticated(self, browser, url):
 """ Getting authenticated. This method may be overwritten. TODO: update to version 2 of the wrappers. Args: ----- browser: The browser in which the user will be authenticated. url: The URL to get authenticated in. Return: ------- True or False. Raises: ------ NoCredentialsException: If no valid credentials have been found. BadImplementationError: If an expected attribute is missing. """

        # check if we have creds
        try:
            if len(self.creds) > 0:
                # TODO: in choosing a cred there is an uneeded nesting of arrays
                c = random.choice(self.creds)[0]
                # adding the credential
                browser.setNewPassword(url, c.user, c.password)
                return True
            else:
                raise NoCredentialsException(str(self))
        except AttributeError as e:
            raise BadImplementationError(str(e))