def METHOD_NAME(rec_pid, data):
    """Mint EPIC PID for published record."""
    epic_pids = [p for p in data['_pid'] if p.get('type') == 'ePIC_PID']
    assert len(epic_pids) == 0
    url = make_record_url(rec_pid.pid_value)
    throw_on_failure = current_app.config.get('CFG_FAIL_ON_MISSING_PID', True)
    try:
        pid = current_handle.create_handle(url)
        if pid is None:
            raise EpicPIDError("EPIC PID allocation failed")
        data['_pid'].append({'value': pid, 'type': 'ePIC_PID'})
    except EpicPIDError as e:
        if throw_on_failure:
            raise e
        else:
            current_app.logger.warning(e)