import socket
import codecs


def inttoip(ip_int: int) -> str:
    """
    Convert an integer into an IPv4 address.
    Adopted from http://goo.gl/AnSFV
    :param ip_int: int for ip address
    :returns: IPv4 address
    """
    return socket.inet_ntoa(codecs.decode(hex(ip_int)[2:].zfill(8).encode(), 'hex'))