def _genMultiply(a, element, n, relicGenMultiplyFunc):
    """
    Multiplies scalar @a by the group generator using @relicGenMultiplyFunc
    and returns the result of type @element.
    """
    # Ensure the scalar is a BigInt
    a = coerceBigInt(a)
    if not a:
        return NotImplemented

    # Shrink large scalars.
    a %= n

    result = element()
    relicGenMultiplyFunc(byref(result), byref(a))
    return result
Multiplies scalar @a by the group generator using @relicGenMultiplyFunc
    and returns the result of type @element.