def parse_filespec(fspec, sep='<STR_LIT::>', gpat='<STR_LIT:*>'):
if sep in fspec:<EOL><INDENT>tpl = (ftype, fpath) = tuple(fspec.split(sep))<EOL><DEDENT>else:<EOL><INDENT>tpl = (ftype, fpath) = (None, fspec)<EOL><DEDENT>return [(fs, ftype) for fs in sorted(glob.glob(fpath))]if gpat in fspec else [flip(tpl)]<EOL>
Parse given filespec `fspec` and return [(filetype, filepath)].

Because anyconfig.load should find correct file's type to load by the file
extension, this function will not try guessing file's type if not file type
is specified explicitly.

:param fspec: filespec
:param sep: a char separating filetype and filepath in filespec
:param gpat: a char for glob pattern

>>> parse_filespec("base.json")
[('base.json', None)]
>>> parse_filespec("json:base.json")
[('base.json', 'json')]
>>> parse_filespec("yaml:foo.yaml")
[('foo.yaml', 'yaml')]
>>> parse_filespec("yaml:foo.dat")
[('foo.dat', 'yaml')]

TODO: Allow '*' (glob pattern) in filepath when escaped with '\\', etc.
# >>> parse_filespec("yaml:bar/*.conf")
# [('bar/a.conf', 'yaml'), ('bar/b.conf', 'yaml')]