'Validate given code.'

def _validate_code(self, code, state):

    check = ((self._code is None) or (code == self._code))
    if (not check):
        _LOGGER.warning('Wrong    code    entered    for    %s', state)
    return check
