def _get_value_from_history(keyword, header):
    """
    Return the value of a keyword from the FITS HISTORY in header.

    Assumes keyword is found in a line of the HISTORY with format: 'keyword = value'.

    Parameters
    ----------
    keyword : str
          keyword to search for such as BMAJ, CLEANBMJ and BMIN
    header : astropy header
          Image header
    """
    for history in header['HISTORY']:
        line = history.replace('=', ' ').split()
        try:
            ind = line.index(keyword)
        except ValueError:
            continue
        return line[ind + 1]
    raise KeyError(f'{keyword} not found in HISTORY')