<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def directional_emd(direction, d1, d2):
 """Compute the EMD between two repertoires for a given direction. The full EMD computation is used for cause repertoires. A fast analytic solution is used for effect repertoires. Args: direction (Direction):
 |CAUSE| or |EFFECT|. d1 (np.ndarray):
 The first repertoire. d2 (np.ndarray):
 The second repertoire. Returns: float: The EMD between ``d1`` and ``d2``, rounded to |PRECISION|. Raises: ValueError: If ``direction`` is invalid. """

    if direction == Direction.CAUSE:
        func = hamming_emd
    elif direction == Direction.EFFECT:
        func = effect_emd
    else:
        # TODO: test that ValueError is raised
        validate.direction(direction)

    return round(func(d1, d2), config.PRECISION)