def parse_field_configured(obj, config):
    """
    Parses an object to a Telegram Type based on the configuration given
    :param obj: The object to parse
    :param config: The configuration:
        - is array?
        - is array in array?
        - type of the class to be loaded to
    :return: the parsed object
    """
    foreign_type = config if type(config) != dict else config['class']
    if type(config) == dict:

        if 'array' in config and config['array'] is True:
            return [foreign_type(x) for x in obj]

        elif 'array_of_array' in config and config['array_of_array'] is True:
            res = []
            for inner_obj in obj:
                res.append([foreign_type(x) for x in inner_obj])
            return res

    return foreign_type(obj)