def result_on_pattern_form(algo_result):
    """
    Generate the information about each detected pattern:

      - encoded result is compliant with 'patterns' property of functional type pattern_groups.

    :param algo_result: result from function result_on_sequences_form from this module.
    :type algo_result: list of dict

    :return: the resulting structure as described by property patterns of functional type pattern_groups.
    :rtype: dict of dict
    """

    if algo_result is None:
        return {}

    else:
        result = {}
        i = 1
        for pattern in algo_result:
            pattern_information = {}
            pattern_information["regex"] = pattern.pop('regex')
            pattern_size = 0
            for tsuid in pattern.keys():
                pattern_size += len((pattern[tsuid])["seq"])
            pattern_information["length"] = pattern_size
            pattern_information["locations"] = pattern
            result["P" + str(i)] = pattern_information
            i += 1
        return result