def _get_pdr_module_dict(ps_data, module_id, key_name=None):
    """
      Returns the first occurrence of a module entry from PDR participant data for the specified module_id
      :param ps_data: A participant data dictionary (assumed to contain a 'modules' key/list of dict values)
      :param module_id: The name / string of the module to search for
      :param key_name:  The key name to extract the value from to match to the supplied module_id string
    """
    if isinstance(key_name, str):
        for mod in ps_data.get('modules'):
            if mod.get(key_name).lower() == module_id.lower():
                return mod

    return None