#NEWLINE# def _get_prefix_length( number1 , number2 , bits ) : #NEWLINE# #INDENT# 'Get the number of leading bits that are same for two numbers.\n\n    Args:\n        number1: an integer.\n        number2: another integer.\n        bits: the maximum number of bits to compare.\n\n    Returns:\n        The number of leading bits that are the same for two numbers.\n\n    ' #NEWLINE# for i in range ( number2 ) : #NEWLINE# #INDENT# if ( ( number1 >> i ) == ( number2 >> i ) ) : #NEWLINE# #INDENT# return ( bits - i ) #NEWLINE# #UNINDENT# #UNINDENT# return 0