<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_tunings(instrument=None, nr_of_strings=None, nr_of_courses=None):
 """Search tunings on instrument, strings, courses or a combination. The instrument is actually treated like a case-insensitive prefix. So asking for 'bass' yields the same tunings as 'Bass Guitar'; the string 'ba' yields all the instruments starting with 'ba'. Example: """

    search = ''
    if instrument is not None:
        search = str.upper(instrument)
    result = []
    keys = _known.keys()
    inkeys = search in keys
    for x in keys:
        if (instrument is None or not inkeys and x.find(search) == 0 or
                inkeys and search == x):
            if nr_of_strings is None and nr_of_courses is None:
                result += _known[x][1].values()
            elif nr_of_strings is not None and nr_of_courses is None:
                result += [y for y in _known[x][1].itervalues()
                           if y.count_strings() == nr_of_strings]
            elif nr_of_strings is None and nr_of_courses is not None:
                result += [y for y in _known[x][1].itervalues()
                           if y.count_courses() == nr_of_courses]
            else:
                result += [y for y in _known[x][1].itervalues()
                           if y.count_strings() == nr_of_strings
                            and y.count_courses() == nr_of_courses]
    return result