def get_uid_from_action_name(action_name, uid_string=None):
    """
    Extract id from action name by splitting at "__", because this marks the start of id in action name.
    If uid string is in action name, remove it
    :param action_name: full action name of processor (e.g. "{action_type}_{aName}_{id}[uid_string}]"
    :param uid_string: uid_string
    :return: {id}
    """
    if uid_string:
        cleaned_name = action_name.replace("_{uid_string}".format(uid_string=uid_string), "")
        return '_{}'.format(cleaned_name.split("__")[-1])
    else:
        return '_{}'.format(action_name.split("__")[-1])