def get_codigo_ccaa(connection, ccaa):
    """
    Return the code from CCAA

    :param connection: Database conection
    :param ccaa: Id of the CCAA
    :return: Codigo CCAA
    :rtype: int, str
    """
    if ccaa:
        data = connection.ResComunitat_autonoma.read(ccaa, ['codi'])
        if data:
            return data['codi']
        else:
            return ''
    else:
        return ''
