def decimal_to_ip(ip_decimal):
    """
    Submit a decimal ip value between 0 and 2*32 - 1.
    Returns the ip_address as a zeros padded string: nnn.nnn.nnn.nnn
    If ip_decimal is invalid returns -1
    """
    
    # Test it is decimal and in range, else return -1
    try:
        ip_decimal = int(ip_decimal)
    except ValueError as e:
        print("ValueError: {}".format(e))
        return -1
    if ip_decimal < 0 or ip_decimal > 4294967295: #(2**32 - 1)
        return -1
    
    # Convert. E.g. 511 returns 000.000.001.255
    s = ""
    for i in reversed(range(4)):  
        s += "{:>03}.".format(ip_decimal // 256**i)
        ip_decimal = ip_decimal % 256**i   
    return s[:-1]

    """
    # To check function: decimal_to_ip()
    test_data = [0,1,255,256,511,512,4294967294,4294967295,-1,4294967296,"qwerty"]
    for i in range(len(test_data)):
        print("{}: {}".format(test_data[i], decimal_to_ip(test_data[i])))
    sys.exit()
    """