def machine_get_by_hostname(hostname):
 try:
  machine = Machine.objects.get(hostname=hostname)
  return machine
 except Machine.DoesNotExist:
  return None

def machine_get_by_hostname ( hostname ) : try : machine = Machine . objects . get ( hostname = hostname ) return machine except Machine . DoesNotExist : return None
returns a machine based on its hostname or none .