def weighted_score(raw_earned, raw_possible, weight):
 assert (raw_possible is not None)
 cannot_compute_with_weight = ((weight is None) or (raw_possible == 0))
 if cannot_compute_with_weight:
  return (raw_earned, raw_possible)
 else:
  return (((float(raw_earned) * weight) / raw_possible), float(weight))

def weighted_score ( raw_earned , raw_possible , weight ) : assert ( raw_possible is not None ) cannot_compute_with_weight = ( ( weight is None ) or ( raw_possible == 0 ) ) if cannot_compute_with_weight : return ( raw_earned , raw_possible ) else : return ( ( ( float ( raw_earned ) * weight ) / raw_possible ) , float ( weight ) )
returns a tuple that represents the weighted score .