refactor on valid_guid (love those ones), PEP8 tidying up