'Save metadata blocks to a file.
Args:
filething (filething)
deleteid3 (bool): delete id3 tags while at it
padding (PaddingFunction)
If no filename is given, the one most recently loaded is used.'

@convert_error(IOError, error)
@loadfile(writable=True)
def save(self, filething, deleteid3=False, padding=None):

    f = StrictFileObject(filething.fileobj)
    header = self.__check_header(f, filething.name)
    audio_offset = self.__find_audio_offset(f)
    available = (audio_offset - header)
    if (deleteid3 and (header > 4)):
        available += (header - 4)
        header = 4
    content_size = (get_size(f) - audio_offset)
    assert (content_size >= 0)
    data = MetadataBlock._writeblocks(self.metadata_blocks, available, content_size, padding)
    data_size = len(data)
    resize_bytes(filething.fileobj, available, data_size, header)
    f.seek((header - 4))
    f.write('fLaC')
    f.write(data)
    if deleteid3:
        try:
            f.seek((-128), 2)
        except IOError:
            pass
        else:
            if (f.read(3) == 'TAG'):
                f.seek((-128), 2)
                f.truncate()
