def SetSegClass(ea, segclass):
    seg = idaapi.getseg(ea)

    if not seg:
        return False

    return idaapi.set_segm_class(seg, segclass)
Change class of the segment
dataset/ETHPy150Open EiNSTeiN-/idapython/python/idc.py/SetSegClass