def is_valid_fingerprint(entry, check_prefix=False):
 try:
  if check_prefix:
   if ((not entry) or (entry[0] != '$')):
    return False
   entry = entry[1:]
  return is_hex_digits(entry, 40)
 except TypeError:
  return False

def is_valid_fingerprint ( entry , check_prefix = False ) : try : if check_prefix : if ( ( not entry ) or ( entry [ 0 ] != '$' ) ) : return False entry = entry [ 1 : ] return is_hex_digits ( entry , 40 ) except TypeError : return False
checks if a string is a properly formatted relay fingerprint .