r'''Returns thermal conductivity of a building, insulating, or refractory
    material from tables  in [1]_, [2]_, and [3]_. Thermal conductivity may or
    may not be dependent on temperature depending on the source used. Function
    must be provided with either a key to one of the dictionaries
    `refractories`, `ASHRAE`, or `building_materials` - or a search term which
    will pick the closest match based on a fuzzy search. To determine which
    source the fuzzy search will pick, use the function `nearest_material`.
    Fuzzy searches are slow; it is preferable to call this function with a
    material key directly.

    Parameters
    ----------
    ID : str
        String as described above
    T : float, optional
        Temperature of the material, [K]

    Returns
    -------
    k : float
        Thermal conductivity of the material, [W/m/K]

    Examples
    --------
    >>> k_material('Mineral fiber')
    0.036

    References
    ----------
    .. [1] ASHRAE Handbook: Fundamentals. American Society of Heating,
       Refrigerating and Air-Conditioning Engineers, Incorporated, 2013.
    .. [2] DIN EN 12524 (2000-07) Building Materials and Products
       Hygrothermal Properties - Tabulated Design Values; English Version of
       DIN EN 12524.
    .. [3] Gesellschaft, V. D. I., ed. VDI Heat Atlas. 2nd edition.
       Berlin; New York:: Springer, 2010.

def k_material(ID, T=298.15):
    r'''Returns thermal conductivity of a building, insulating, or refractory
    material from tables  in [1]_, [2]_, and [3]_. Thermal conductivity may or
    may not be dependent on temperature depending on the source used. Function
    must be provided with either a key to one of the dictionaries
    `refractories`, `ASHRAE`, or `building_materials` - or a search term which
    will pick the closest match based on a fuzzy search. To determine which
    source the fuzzy search will pick, use the function `nearest_material`.
    Fuzzy searches are slow; it is preferable to call this function with a
    material key directly.

    Parameters
    ----------
    ID : str
        String as described above
    T : float, optional
        Temperature of the material, [K]

    Returns
    -------
    k : float
        Thermal conductivity of the material, [W/m/K]

    Examples
    --------
    >>> k_material('Mineral fiber')
    0.036

    References
    ----------
    .. [1] ASHRAE Handbook: Fundamentals. American Society of Heating,
       Refrigerating and Air-Conditioning Engineers, Incorporated, 2013.
    .. [2] DIN EN 12524 (2000-07) Building Materials and Products
       Hygrothermal Properties - Tabulated Design Values; English Version of
       DIN EN 12524.
    .. [3] Gesellschaft, V. D. I., ed. VDI Heat Atlas. 2nd edition.
       Berlin; New York:: Springer, 2010.
    '''
    if ID not in materials_dict:
        ID = nearest_material(ID)
    if ID in refractories:
        return refractory_VDI_k(ID, T)
    elif ID in ASHRAE:
        return ASHRAE_k(ID)
    else:
        return float(building_materials[ID][1])