<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def style_format(text, style):
 """ Wraps texts in terminal control sequences Style can be passed as either a collection or space delimited string. Valid styles can be found in the codes module. Invalid or unsuported styles will just be ignored. """

    if not style:
        return text
    if isinstance(style, str):
        style = style.split(" ")
    prefix = ""
    for s in style:
        prefix += codes.colours.get(s, "")
        prefix += codes.highlights.get(s, "")
        prefix += codes.modes.get(s, "")
    return prefix + text + codes.modes["reset"]