<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def format(self, format_spec='f'):
 u""" Formata o CNPJ. Códigos de formatação: r -> raw f -> formatado '58414462000135' '58.414.462/0001-35' """

        if format_spec == '' or format_spec == 'f':
            cnpj = CNPJ.clean(self._cnpj)
            return '{0}.{1}.{2}/{3}-{4}'.format(cnpj[0:2], cnpj[2:5], cnpj[5:8], cnpj[8:12], cnpj[12:14])
        if format_spec == 'r':
            return self._cnpj
        raise ValueError(
            "Unknown format code '{0}' for object of type '{1}'".format(format_spec, CNPJ.__name__))