def make_cidr(gw, mask):
    """Create network address in CIDR format.

    Return network address for a given gateway address and netmask.
    """
    try:
        int_mask = (0xFFFFFFFF << (32 - int(mask))) & 0xFFFFFFFF
        gw_addr_int = struct.unpack('>L', socket.inet_aton(gw))[0] & int_mask
        return (socket.inet_ntoa(struct.pack("!I", gw_addr_int)) +
                '/' + str(mask))
    except (socket.error, struct.error, ValueError, __HOLE__):
        return
dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/apps/saf/common/utils.py/make_cidr