def format(self, format_spec='f'):
        u"""
        Formata o CPF.

        Códigos de formatação:
        r -> raw
        f -> formatado

        >>> cpf = CPF(58119443659)
        >>> cpf.format('r')
        '58119443659'
        >>> cpf.format('f')
        '581.194.436-59'
        """
        if format_spec == '' or format_spec == 'f':
            cpf = CPF.clean(self._cpf)
            return '{0}.{1}.{2}-{3}'.format(cpf[0:3], cpf[3:6], cpf[6:9], cpf[9:11])
        if format_spec == 'r':
            return self._cpf
        raise ValueError(
            "Unknown format code '{0}' for object of type '{1}'".format(format_spec, CPF.__name__))