'mask or unmask data. Just do xor for each byte
mask_key: 4 byte string(byte).
data: data to mask/unmask.'

@staticmethod
def mask(mask_key, data):

    if (data == None):
        data = ''
    if isinstance(mask_key, six.text_type):
        mask_key = six.b(mask_key)
    if isinstance(data, six.text_type):
        data = six.b(data)
    _m = array.array('B', mask_key)
    _d = array.array('B', data)
    for i in range(len(_d)):
        _d[i] ^= _m[(i % 4)]
    if six.PY3:
        return _d.tobytes()
    else:
        return _d.tostring()
