def _is_udp_in_ipv4(pkt):
    """If UDP is in IPv4 packet return True,
    else return False. False is returned also if exception occurs."""
    ipv4_type = int('0x0800', 16)  # IPv4
    try:
        if pkt.type == ipv4_type:
            if pkt.payload.proto == 17:  # UDP
                return True
    except:  # pylint: disable=bare-except
        return False
    return False