given an ip address in dotteddecimal representation determine the binary representation for example decimaltobinary255 0 0 5 returns 11111111 00000000 00000000 00000101 accepts string returns string convert 8bit decimal number to binary representation type val str rtype str convert dotteddecimal ip address to binary representation with help of decimaltobinaryutil convert 8 bit decimal number to binary representation type val str rtype str convert dotted decimal ip address to binary representation with help of decimal_to_binary_util
def decimal_to_binary_util(val):
    
    bits = [128, 64, 32, 16, 8, 4, 2, 1]
    val = int(val)
    binary_rep = ''
    for bit in bits:
        if val >= bit:
            binary_rep += str(1)
            val -= bit
        else:
            binary_rep += str(0)

    return binary_rep

def decimal_to_binary_ip(ip):
    
    values = ip.split('.')
    binary_list = []
    for val in values:
        binary_list.append(decimal_to_binary_util(val))
    return '.'.join(binary_list)