'Generates and writes show_obj\'s metadata under the given path to the
filename given by get_show_file_path()
show_obj: TVShow object for which to create the metadata
path: An absolute or relative path where we should put the file. Note that
the file name will be the default show_file_name.
Note that this method expects that _show_data will return an ElementTree
object. If your _show_data returns data in another format yo\'ll need to
override this method.'

def write_show_file(self, show_obj):

    data = self._show_data(show_obj)
    if (not data):
        return False
    nfo_file_path = self.get_show_file_path(show_obj)
    assert isinstance(nfo_file_path, six.text_type)
    nfo_file_dir = ek(os.path.dirname, nfo_file_path)
    try:
        if (not ek(os.path.isdir, nfo_file_dir)):
            logger.log((u"Metadata    dir    didn't    exist,    creating    it    at    " + nfo_file_dir), logger.DEBUG)
            ek(os.makedirs, nfo_file_dir)
            helpers.chmodAsParent(nfo_file_dir)
        logger.log((u'Writing    show    nfo    file    to    ' + nfo_file_path), logger.DEBUG)
        nfo_file = io.open(nfo_file_path, u'wb')
        data.write(nfo_file, encoding=u'UTF-8')
        nfo_file.close()
        helpers.chmodAsParent(nfo_file_path)
    except IOError as e:
        logger.log((((u'Unable    to    write    file    to    ' + nfo_file_path) + u'    -    are    you    sure    the    folder    is    writable?    ') + ex(e)), logger.ERROR)
        return False
    return True
