'Write data to a worksheet cell by calling the appropriate write_*()
method based on the type of data being passed.
Args:
row:   The cell row (zero indexed).
col:   The cell column (zero indexed).
*args: Args to pass to sub functions.
Returns:
0:    Success.
-1:    Row or column is out of worksheet bounds.
other: Return value of called method.'

@convert_cell_args
def write(self, row, col, *args):

    if (not len(args)):
        raise TypeError('write()    takes    at    least    4    arguments    (3    given)')
    token = args[0]
    if (token is None):
        return self.write_blank(row, col, *args)
    if isinstance(token, bool):
        return self.write_boolean(row, col, *args)
    if supported_datetime(token):
        return self.write_datetime(row, col, *args)
    if isinstance(token, num_types):
        return self.write_number(row, col, *args)
    if isinstance(token, str_types):
        if (token == ''):
            return self.write_blank(row, col, *args)
        elif (self.strings_to_formulas and token.startswith('=')):
            return self.write_formula(row, col, *args)
        elif (self.strings_to_urls and re.match('(ftp|http)s?://', token)):
            return self.write_url(row, col, *args)
        elif (self.strings_to_urls and re.match('mailto:', token)):
            return self.write_url(row, col, *args)
        elif (self.strings_to_urls and re.match('(in|ex)ternal:', token)):
            return self.write_url(row, col, *args)
        elif self.strings_to_numbers:
            try:
                f = float(token)
                if (self.nan_inf_to_errors or ((not self._isnan(f)) and (not self._isinf(f)))):
                    return self.write_number(row, col, f, *args[1:])
            except ValueError:
                pass
            return self.write_string(row, col, *args)
        else:
            return self.write_string(row, col, *args)
    try:
        f = float(token)
        return self.write_number(row, col, f, *args[1:])
    except ValueError:
        pass
    except TypeError:
        raise TypeError(('Unsupported    type    %s    in    write()' % type(token)))
    try:
        str(token)
        return self.write_string(row, col, *args)
    except ValueError:
        raise TypeError(('Unsupported    type    %s    in    write()' % type(token)))
