human
Complete this python program:
def exception_translated(exception_type):
assistant
#Here is the Python code you requested.

    """Wrap API calls to map to correct exception.
    """
    def _exception_translated(f):
        @functools.wraps(f)
        def wrapper(self, *args, **kwargs):
            try:
                return f(self, *args, **kwargs)
            except exception.PublicIDNotFound as e:
                if (exception_type == 'user'):
                    raise exception.UserNotFound(user_id=str(e))
                elif (exception_type == 'group'):
                    raise exception.GroupNotFound(group_id=str(e))
                elif (exception_type == 'assertion'):
                    raise AssertionError(_('Invalid    user    /    password'))
                else:
                    raise
        return wrapper
    return _exception_translated