import ipaddress


def ip_to_hex(ip):
    """Converts an IP address in string format to a hex string.

    Args:
        ip (str): An IP address in string format that is able to be converted by `ipaddress` library.

    Returns:
        str: HEX value of the IP address.

    Example:
        >>> from netutils.ip import ip_to_hex
        >>> ip_to_hex("10.100.100.100")
        '0a646464'
        >>>
    """
    ip_obj = ipaddress.ip_address(ip)
    return str(hex(int(ip_obj)))[2:].zfill(int(ip_obj.max_prefixlen / 4))