def to_credentials(arg):
if pimms.is_str(arg):<EOL><INDENT>try: return load_credentials(arg)<EOL>except Exception: pass<EOL>try: return str_to_credentials(arg)<EOL>except Exception:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>' % arg)<EOL><DEDENT><DEDENT>elif pimms.is_map(arg) and '<STR_LIT:key>' in arg and '<STR_LIT>' in arg: return (arg['<STR_LIT:key>'], arg['<STR_LIT>'])<EOL>elif pimms.is_vector(arg, str) and len(arg) == <NUM_LIT:2>: return tuple(arg)<EOL>else: raise ValueError('<STR_LIT>' % arg)<EOL>
to_credentials(arg) converts arg into a pair (key, secret) if arg can be coerced into such a
  pair and otherwise raises an error.

Possible inputs include:
  * A tuple (key, secret)
  * A mapping with the keys 'key' and 'secret'
  * The name of a file that can load credentials via the load_credentials() function
  * A string that separates the key and secret by ':', e.g., 'mykey:mysecret'
  * A string that separates the key and secret by a "\n", e.g., "mykey\nmysecret"