def get_quote_num(num, count, name):
 if num:
  num = int(num)
 if (count == 0):
  raise Exception('No quotes found for {}.'.format(name))
 if (num and (num < 0)):
  num = (((count + num) + 1) if ((num + count) > (-1)) else (count + 1))
 if (num and (num > count)):
  raise Exception('I only have {} quote{} for {}.'.format(count, ('s', '')[(count == 1)], name))
 if (num and (num == 0)):
  num = 1
 if (not num):
  num = random.randint(1, count)
 return num

def get_quote_num ( num , count , name ) : if num : num = int ( num ) if ( count == 0 ) : raise Exception ( 'No quotes found for {}.' . format ( name ) ) if ( num and ( num < 0 ) ) : num = ( ( ( count + num ) + 1 ) if ( ( num + count ) > ( - 1 ) ) else ( count + 1 ) ) if ( num and ( num > count ) ) : raise Exception ( 'I only have {} quote{} for {}.' . format ( count , ( 's' , '' ) [ ( count == 1 ) ] , name ) ) if ( num and ( num == 0 ) ) : num = 1 if ( not num ) : num = random . randint ( 1 , count ) return num
returns the quote number to fetch from the db .