<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_scalar(self, cursor, index=0):
 """Returns a single value from the first returned record from a cursor. By default it will get cursor.fecthone()[0] which works with tuples and namedtuples. For dict cursor it is necessary to specify index. This method will not work with cursors that aren't indexable. :param cursor: a cursor object :param index: the index of the cursor to return the value from """

    if isinstance(index, int):
      return cursor.fetchone()[index]
    else:
      return get_value(cursor.fetchone(), index)