def METHOD_NAME(
    self, remote_cmd: str = "", remote_file: Optional[str] = None
) -> int:
    """Get the file size of the remote file."""
    if remote_file is None:
        if self.direction == "put":
            remote_file = self.dest_file
        elif self.direction == "get":
            remote_file = self.source_file
        else:
            raise ValueError("Invalid value for file transfer direction.")
    if not remote_cmd:
        remote_cmd = f"dir {self.file_system}/{remote_file}"
    remote_out = self.ssh_ctl_chan._send_command_str(remote_cmd)
    if re.search("no such file or directory", remote_out, flags=re.I):
        raise IOError("Unable to find file on remote system")
    # Match line containing file name
    escape_file_name = re.escape(remote_file)
    pattern = r".*({}).*".format(escape_file_name)
    match = re.search(pattern, remote_out)
    if match:
        file_size = match.group(0)
        file_size = file_size.split()[0]
        return int(file_size)
    raise IOError("Unable to find file on remote system")