def get_filepath_or_buffer(filepath_or_buffer, encoding=None,<EOL>compression=None, mode=None):
filepath_or_buffer = _stringify_path(filepath_or_buffer)<EOL>if _is_url(filepath_or_buffer):<EOL><INDENT>req = urlopen(filepath_or_buffer)<EOL>content_encoding = req.headers.get('<STR_LIT>', None)<EOL>if content_encoding == '<STR_LIT>':<EOL><INDENT>compression = '<STR_LIT>'<EOL><DEDENT>reader = BytesIO(req.read())<EOL>req.close()<EOL>return reader, encoding, compression, True<EOL><DEDENT>if is_s3_url(filepath_or_buffer):<EOL><INDENT>from pandas.io import s3<EOL>return s3.get_filepath_or_buffer(filepath_or_buffer,<EOL>encoding=encoding,<EOL>compression=compression,<EOL>mode=mode)<EOL><DEDENT>if is_gcs_url(filepath_or_buffer):<EOL><INDENT>from pandas.io import gcs<EOL>return gcs.get_filepath_or_buffer(filepath_or_buffer,<EOL>encoding=encoding,<EOL>compression=compression,<EOL>mode=mode)<EOL><DEDENT>if isinstance(filepath_or_buffer, (str, bytes, mmap.mmap)):<EOL><INDENT>return _expand_user(filepath_or_buffer), None, compression, False<EOL><DEDENT>if not is_file_like(filepath_or_buffer):<EOL><INDENT>msg = "<STR_LIT>"<EOL>raise ValueError(msg.format(_type=type(filepath_or_buffer)))<EOL><DEDENT>return filepath_or_buffer, None, compression, False<EOL>
If the filepath_or_buffer is a url, translate and return the buffer.
Otherwise passthrough.

Parameters
----------
filepath_or_buffer : a url, filepath (str, py.path.local or pathlib.Path),
                     or buffer
compression : {{'gzip', 'bz2', 'zip', 'xz', None}}, optional
encoding : the encoding to use to decode bytes, default is 'utf-8'
mode : str, optional

Returns
-------
tuple of ({a filepath_ or buffer or S3File instance},
          encoding, str,
          compression, str,
          should_close, bool)