def authenticate(self, username = None, otp = None):
		if not otp:
			return None

		count = len(otp)
		device_id = otp[0][:12]

		try:
			yubico = YubicoKey.objects.get(user__username = username, \
									device_id = device_id)
		except YubicoKey.DoesNotExist:
			return None
		
		if not yubico.user.is_active or not yubico.enabled:
			return None
		
		secret_key = yubico.secret_key or None
		client = Yubico(yubico.client_id, secret_key)
		
		try:
			if count > 1:
				# More then 1 OTP provided, using multi mode
				status = client.verify_multi(otp_list = otp, max_time_window = YUBICO_MULTI_TIMEOUT)
			else:
				status = client.verify(otp[0])
		except YubicoError:
			return None
		
		if not status:
			return None
		
		return yubico.user