def get_cred(self):
        """Get new credentials.

        Return a credentials dictionary (see set_cred()). Raise an
        IndexError exception if self.max_tries have already been made.
        """
        if not self.dirty and self.cred is not None:
            self.try_count = self.try_count + 1
            self.dirty = True
            return self.cred

        if self.try_count > self.max_tries:
            raise IndexError("Exceeded max_tries ({})".format(self.max_tries))

        self.cred = self.callback(self)
        self.try_count = self.try_count + 1

        self.dirty = True
        return self.cred
Get new credentials.

        Return a credentials dictionary (see set_cred()). Raise an
        IndexError exception if self.max_tries have already been made.
        
recipes/Python/578217_Cosign_Handler/recipe-578217.py