<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def macro_tpm(self, micro_tpm, check_independence=True):
 """Create a coarse-grained macro TPM. Args: micro_tpm (nd.array):
 The TPM of the micro-system. check_independence (bool):
 Whether to check that the macro TPM is conditionally independent. Raises: ConditionallyDependentError: If ``check_independence`` is ``True`` and the macro TPM is not conditionally independent. Returns: np.ndarray: The state-by-node TPM of the macro-system. """

        if not is_state_by_state(micro_tpm):
            micro_tpm = convert.state_by_node2state_by_state(micro_tpm)

        macro_tpm = self.macro_tpm_sbs(micro_tpm)

        if check_independence:
            validate.conditionally_independent(macro_tpm)

        return convert.state_by_state2state_by_node(macro_tpm)