human
Complete the below
def commonPrefix(completions):

    ''''Utility function which is used by console to extract the string to be
    suggested as autocompletion.
    :param completions: [(part, completion)] where part is a prefix of completion
    (see core.ui.console.menu)
    :author: Alexander Berezhnoy (alexander.berezhnoy |at| gmail.com)'
    '''
 Give me a Python program to fix of completion?
assistant
#Here is Python program to fix of completion
.
    def cp(str1, str2):
        '\n                                :return:    the    longest    common    prefix    for    2    strings.\n                                '
        ls2 = len(str2)
        j = 1
        for i in range(len(str1)):
            if ((i >= ls2) or (str1[i] != str2[i])):
                j = 0
                break
        result = str1[:(i + j)]
        return result
    strs = [v[len(p):] for (p, v) in completions]
    if (len(strs) == 0):
        return ''
    if (len(strs) == 1):
        return strs[0]
    (result, tail) = (strs[0], strs[1:])
    for i in range(len(tail)):
        result = cp(result, tail[i])
        if (result == ''):
            break
    return result