Convert a string representing an IPv4 address to 4 bytes.

def ip_to_array(ipaddress):
    """Convert a string representing an IPv4 address to 4 bytes."""
    res = []
    for i in ipaddress.split("."):
        res.append(int(i))

    assert len(res) == 4
    return res