def format_str_space(list_tuples):
    """
    Format spacing and lenght of a string(text).
    Used to format text before print it
    :param list_tuples: a list of tuples ( text_to_format, 'l' or 'c' or 'r', text_width )
    l : left justified
    c: centered
    r : right justified
    :return: a single string
    """
    formatted_str = ''
    for tupleset in list_tuples:
        formatted_section = ''
        if tupleset[1] == 'l':
            formatted_section = tupleset[0].strip()[:tupleset[2]].ljust(tupleset[2])
        elif tupleset[1] == 'c':
            formatted_section = tupleset[0].center(tupleset[2])
        elif tupleset[1] == 'r':
            formatted_section = tupleset[0].strip()[:tupleset[2]].rjust(tupleset[2])

        formatted_str += formatted_section + ' '

    return formatted_str