Refactor the `matches` function

- Clearer parameter names and doc string
- Use fnmatch.fnmatch instead of re.match and fnmatch.translate
- Use `any` to make code more succint.

Change-Id: Id22aef35554c2a3428874f956c54baae3ea662fe