def match_device(device):
 match = re.match('(^/dev/x{0,1}[a-z]{0,1}d{0,1})([a-z]+)[0-9]*$', device)
 if (not match):
  return None
 return match.groups()

def match_device ( device ) : match = re . match ( '(^/dev/x{0,1}[a-z]{0,1}d{0,1})([a-z]+)[0-9]*$' , device ) if ( not match ) : return None return match . groups ( )
matches device name and returns prefix .