import socket
import fcntl
import struct


def get_ip_address(interfaceName):
    """
    Returns a network interface's IPv4 address
    Args:
        interfaceName: the network interface's name
    Returns:
        the network interface's IPv4 address
    """

    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    return socket.inet_ntoa(fcntl.ioctl(
        s.fileno(),
        0x8915,
        struct.pack('256s', interfaceName[:15])
    )[20:24])