In Russia, there is an army-purposed station named UVB-76 or "Buzzer" (see also https://en.wikipedia.org/wiki/UVB-76). Most of time specific "buzz" noise is being broadcasted, but on very rare occasions, the buzzer signal is interrupted and a voice transmission in Russian takes place. Transmitted messages have always the same format like this:

 MDZHB 01 213 SKIF 38 87 23 95 

or: 

 MDZHB 80 516 GANOMATIT 21 23 86 25 

Message format consists of following parts:

 Initial keyword "MDZHB"; 
 Two groups of digits, 2 digits in first and 3 in second ones; 
 Some keyword of arbitrary length consisting only of uppercase letters; 
 Final 4 groups of digits with 2 digits in each group. 

  
Your task is to write a function that can validate the correct UVB-76 message. Function should return "True" if message is in correct format and "False" otherwise.

Source: codewars | Difficulty: EASY

Starter code: def validate(message):
	

Solutions:
import re
validate = lambda msg: bool(re.match('^MDZHB \\d\\d \\d\\d\\d [A-Z]+ \\d\\d \\d\\d \\d\\d \\d\\d$', msg))


import re

def validate(message):
	return bool(re.match('^MDZHB \\d{2} \\d{3} [A-Z]+ \\d{2} \\d{2} \\d{2} \\d{2}$', message))


import re

def validate(message):
	return re.match('^MDZHB( \\d\\d){2}\\d [A-Z]+( \\d\\d){4}$', message) != None


from re import compile, match
REGEX = compile('MDZHB \\d{2} \\d{3} [A-Z]+ \\d{2} \\d{2} \\d{2} \\d{2}$')

def validate(message):
	return bool(match(REGEX, message))


REGEX = __import__('re').compile('MDZHB( \\d\\d){2}\\d [A-Z]+( \\d\\d){4}').fullmatch

def validate(message):
	return bool(REGEX(message))


import re

def validate(s):
	return bool(re.match('MDZHB \\d\\d \\d{3} [A-Z]+( \\d\\d){4}$', s))


import re

def validate(message):
	return bool(re.match('MDZHB \\d\\d \\d\\d\\d [A-Z]+( \\d\\d){4}$', message))


def validate(message):
	ml = message.split()
	if len(ml) != 8:
		return False
	if ml[0] != 'MDZHB':
		return False
	if len(ml[1]) != 2 or not ml[1].isdigit():
		return False
	if len(ml[2]) != 3 or not ml[2].isdigit():
		return False
	if not ml[3].isalpha() or not ml[3].isupper():
		return False
	for x in ml[4:]:
		if len(x) != 2 or not x.isdigit():
			return False
	return True