<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_identities(cls, db, identities, backend):
 """ Load identities list from backend in Sorting Hat """


        logger.info("Adding the identities to SortingHat")

        total = 0

        for identity in identities:
            try:
                cls.add_identity(db, identity, backend)
                total += 1
            except Exception as e:
                logger.error("Unexcepted error when adding identities: %s" % e)
                continue

        logger.info("Total identities added to SH: %i", total)