<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def register_element(self, dev_name, idx=None):
 """ Register a device element to the group list Parameters dev_name : str model name idx : str element idx Returns ------- str assigned idx """

        if dev_name not in self.devices:
            logger.error(
                'Device {} missing. call add_device before adding elements'.
                format(dev_name))
            return
        group_name = self.system.__dict__[dev_name]._group
        if idx is None:  # "if not idx" will fail for idx==0.0
            idx = dev_name + '_' + str(len(self.group[group_name].keys()))
        self.group[group_name][idx] = dev_name
        return idx