Creates a C key from a Python key
    :param tc: The transcoder to use
    :param pykey: The python key to encode
    :return: A tuple of `encoded_key, encoded_length`

def create_key(tc, pykey):
    """
    Creates a C key from a Python key
    :param tc: The transcoder to use
    :param pykey: The python key to encode
    :return: A tuple of `encoded_key, encoded_length`
    """
    try:
        k_enc = tc.encode_key(pykey)
        if not k_enc:
            if not pykey:
                excls = ArgumentError
            else:
                excls = ValueFormatError
            raise excls.pyexc("Key is empty", obj=pykey)

    except (ValueFormatError, ArgumentError):
        raise
    except Exception as e:
        raise ValueFormatError.pyexc(inner=e)

    s_key = ffi.new('char[]', k_enc)
    return s_key, len(k_enc)