import io


def get_file_from_gitlab(gitpkg, path, ref="master"):
    """Retrieves a file from a Gitlab repository, returns a (StringIO) file."""

    return io.StringIO(gitpkg.files.get(file_path=path, ref=ref).decode())