def ipv4_prefix_to_mask(prefix):
if prefix > <NUM_LIT:32> or prefix < <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>mask = ((<NUM_LIT:1> << <NUM_LIT:32>) - <NUM_LIT:1>) ^ ((<NUM_LIT:1> << (<NUM_LIT:32> - prefix)) - <NUM_LIT:1>)<EOL>eight_ones = <NUM_LIT:255>  <EOL>mask_str = '<STR_LIT>'<EOL>for i in range(<NUM_LIT:0>, <NUM_LIT:4>):<EOL><INDENT>mask_str = str(mask & eight_ones) + mask_str<EOL>mask = mask >> <NUM_LIT:8><EOL>if i != <NUM_LIT:3>:<EOL><INDENT>mask_str = '<STR_LIT:.>' + mask_str<EOL><DEDENT><DEDENT>return mask_str<EOL><DEDENT>
ipv4 cidr prefix to net mask

:param prefix: cidr prefix , rang in (0, 32)
:type prefix: int
:return: dot separated ipv4 net mask code, eg: 255.255.255.0
:rtype: str