'write tag and data'

def write_element(self, arr, mdtype=None):

    if (mdtype is None):
        mdtype = NP_TO_MTYPES[arr.dtype.str[1:]]
    if (arr.dtype.byteorder == swapped_code):
        arr = arr.byteswap().newbyteorder()
    byte_count = (arr.size * arr.itemsize)
    if (byte_count <= 4):
        self.write_smalldata_element(arr, mdtype, byte_count)
    else:
        self.write_regular_element(arr, mdtype, byte_count)
