def query_header(ad, requested_input):
    """
    Returns the header value associated with the 'requested_input'
    string.  The requested_input strings are defined in get_req_input_list(),
    and they correspond to columns in the observation summary table.

    :param ad: AstroData object that contains the header information.
    :type ad: AstroData object
    :param requested_input: Information to retrieve from the header.  The
        valid strings correspond to the 'id' in the dictionaries returned
        by get_req_input_list().  Only the prompts with 'in_hdr'=True are
        valid.
    :type requested_input: str
    :rtype: str
    """

    # warning: might not be efficient if the descriptor system is slow
    # might have to change to if-elif sequence.  (but it's kinda cool
    # looking this way.)
    return {
        'targetname' : ad.object().as_str(),
        'band'       : ad.filter_name(pretty=True).as_str(),
        'grism'      : ad.disperser(pretty=True).as_str(),
        'exptime'    : ad.exposure_time().as_float(),
        'lnrs'       : ad.phu_get_key_value('LNRS'),
        'rdmode'     : ad.read_mode(pretty=True).as_str()
    }[requested_input]