def pinyin(char, variant='mandarin', sep=' ', out='tones'):
    """
    Retrieve Pinyin of a character.
    """
    if len(char) > 1:
        return sep.join([pinyin(c, variant=variant, sep=sep, out=out) for c in char])

    if not is_chinese(char):
        return char

    if char in _cd.GBK: 
        char = gbk2big5(char)

    out_char = _cd.UNIHAN.get(char, {variant: '?({0}'.format(char)}).get(variant, '!({0})'.format(char))

    if out != 'tones':
        out_char = ''.join([tone_converter.get(x, x) for x in out_char])    

    return out_char
Retrieve Pinyin of a character.