def permute(string):
    """permute(str) -> str

        Outputs a list of all possible permutations a string.

        Note: If a character is repeated, each occurence as distinct.

        >>> permute('abc')
        ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
        >>> permute('dog')
        ['dog', 'dgo', 'odg', 'ogd', 'gdo', 'god']
    """
    if not isinstance(string, str):
        raise TypeError("Must be a string")

    result = []

    if len(string) == 1:
        result = [string]
    else:
        for count, char in enumerate(string):
            for variation in permute(string[:count] + string[count + 1:]):
                result += [char + variation]

    return result