def a_valid_tap(tap):
 regex = re.compile('^([\\w-]+)/(homebrew-)?([\\w-]+)$')
 return regex.match(tap)

def a_valid_tap ( tap ) : regex = re . compile ( '^([\\w-]+)/(homebrew-)?([\\w-]+)$' ) return regex . match ( tap )
returns true if the tap is valid .