<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_binary_array(self, key, value):
 """Create method of CRUD operation for binary array data. Args: key (string):
 The variable to write to the DB. value (any):
 The data to write to the DB. Returns: (string):
 Result of DB write. """

        data = None
        if key is not None and value is not None:
            value_encoded = []
            for v in value:
                try:
                    # py2
                    # convert to bytes as required for b64encode
                    # decode bytes for json serialization as required for json dumps
                    value_encoded.append(base64.b64encode(bytes(v)).decode('utf-8'))
                except TypeError:
                    # py3
                    # set encoding on string and convert to bytes as required for b64encode
                    # decode bytes for json serialization as required for json dumps
                    value_encoded.append(base64.b64encode(bytes(v, 'utf-8')).decode('utf-8'))
            data = self.db.create(key.strip(), json.dumps(value_encoded))
        else:
            self.tcex.log.warning(u'The key or value field was None.')
        return data