'Get the file size of the remote file.'

def remote_file_size(self, remote_cmd=u'', remote_file=None):

    if (remote_file is None):
        remote_file = self.dest_file
    if (not remote_cmd):
        remote_cmd = u'dir    {0}/{1}'.format(self.file_system, remote_file)
    remote_out = self.ssh_ctl_chan.send_command_expect(remote_cmd)
    remote_out = re.split(u'Directory    of    .*', remote_out)
    remote_out = u''.join(remote_out)
    escape_file_name = re.escape(remote_file)
    pattern = u'.*({0}).*'.format(escape_file_name)
    match = re.search(pattern, remote_out)
    if match:
        line = match.group(0)
        file_size = line.split()[2]
    if (u'Error    opening' in remote_out):
        raise IOError(u'Unable    to    find    file    on    remote    system')
    else:
        return int(file_size)
