def _assign_dates(self):
if self.tree is None:<EOL><INDENT>self.logger("<STR_LIT>", <NUM_LIT:0>)<EOL>return ttconf.ERROR<EOL><DEDENT>bad_branch_counter = <NUM_LIT:0><EOL>for node in self.tree.find_clades(order='<STR_LIT>'):<EOL><INDENT>if node.name in self.date_dict:<EOL><INDENT>tmp_date = self.date_dict[node.name]<EOL>if np.isscalar(tmp_date) and np.isnan(tmp_date):<EOL><INDENT>self.logger("<STR_LIT>"%(node.name, str(tmp_date)), <NUM_LIT:2>, warn=True)<EOL>node.raw_date_constraint = None<EOL>node.bad_branch = True<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>tmp = np.mean(tmp_date)<EOL>node.raw_date_constraint = tmp_date<EOL>node.bad_branch = False<EOL><DEDENT>except:<EOL><INDENT>self.logger("<STR_LIT>"%(node.name, str(tmp_date)), <NUM_LIT:2>, warn=True)<EOL>node.raw_date_constraint = None<EOL>node.bad_branch = True<EOL><DEDENT><DEDENT><DEDENT>else: <EOL><INDENT>node.raw_date_constraint = None<EOL>if node.is_terminal():<EOL><INDENT>node.bad_branch = True<EOL><DEDENT>else:<EOL><INDENT>node.bad_branch = np.all([x.bad_branch for x in node])<EOL><DEDENT><DEDENT>if node.is_terminal() and node.bad_branch:<EOL><INDENT>bad_branch_counter += <NUM_LIT:1><EOL><DEDENT><DEDENT>if bad_branch_counter>self.tree.count_terminals()-<NUM_LIT:3>:<EOL><INDENT>self.logger("<STR_LIT>", <NUM_LIT:1>, warn=True)<EOL>return ttconf.ERROR<EOL><DEDENT>return ttconf.SUCCESS<EOL>
assign dates to nodes

        Returns
        -------
        str
            success/error code