def is_valid_gadget(gadget, bad_chars):
    """Determine if a gadget is valid (i.e., contains no bad characters).

    Args:
        gadget (Gadget): A namedtuple-like object with `shellcode` and `asm`
            fields.
        bad_chars (bytearray): The bad characters not allowed to be present.

    Returns:
        bool: Whether the specified gadget is acceptable.

    """
    gadget_chars = bytearray(gadget.shellcode)
    for bc in bad_chars:
        if bc in gadget_chars:
            return False
    return True