Retrieves a value from obj.cached (if not None) or calls @relicFunc and 
    caches the result (of @resultType) int obj.cached.

    This is a common implementation for orderG1/G2/Gt and generatotG1/G2/Gt

def _getCachedValue(obj, relicFunc, resultType):
    """
    Retrieves a value from obj.cached (if not None) or calls @relicFunc and 
    caches the result (of @resultType) int obj.cached.

    This is a common implementation for orderG1/G2/Gt and generatotG1/G2/Gt
    """
    # If the value has not been previously cached, fetch 
    if not obj.cached:
        obj.cached = resultType()
        relicFunc(byref(obj.cached))
    return obj.cached