def format_fing(fingerprint):
    """
    Format a fingerprint by capitalizing it and adding spaces every
    four characters.

    >>> format_fing('abc123def456ghi789jkl012mno345pqr678stu9')
    'ABC1 23DE F456 GHI7 89JK L012 MNO3 45PQ R678 STU9'

    @type fingerprint: C{string} or C{buffer}
    @param fingerprint: The 40-character fingerprint.
    @rtype: C{string}
    @return: The capitalized fingerprint with spaces every four
    characters.
    """
    fingerprint_list = [str(fingerprint)[i:(i + 4)] for i in
            range(0, 40, 4)]
    new_fingerprint = " ".join(fingerprint_list)

    return new_fingerprint.upper()