def _get_observed_mmax(catalogue, config):
    '''Check see if observed mmax values are input, if not then take
    from the catalogue'''
    if config['input_mmax']:
        obsmax = config['input_mmax']
        if config['input_mmax_uncertainty']:
            return config['input_mmax'], config['input_mmax_uncertainty']
        else:
            raise ValueError('Input mmax uncertainty must be specified!')

    max_location = np.argmax(catalogue['magnitude'])
    obsmax = catalogue['magnitude'][max_location]
    cond = isinstance(catalogue['sigmaMagnitude'], np.ndarray) and \
        len(catalogue['sigmaMagnitude']) > 0 and not \
        np.all(np.isnan(catalogue['sigmaMagnitude']))

    if cond:
        if not np.isnan(catalogue['sigmaMagnitude'][max_location]):
            return obsmax, catalogue['sigmaMagnitude'][max_location]
        else:
            print('Uncertainty not given on observed Mmax\n'
                  'Taking largest magnitude uncertainty found in catalogue')
            return obsmax, np.nanmax(catalogue['sigmaMagnitude'])
    elif config['input_mmax_uncertainty']:
        return obsmax, config['input_mmax_uncertainty']
    else:
        raise ValueError('Input mmax uncertainty must be specified!')
Check see if observed mmax values are input, if not then take
    from the catalogue