def _upload_file(sftp, local_file, remote_file):
    """ Upload a file using existent sftp session
    :param sftp: sftp session object
    :param local_file: either a file path or a file-like object to be uploaded.
    :param remote_file: a remote file path where the uploaded file will be
        placed.

    """
    if hasattr(local_file, 'read'):
        sftp.putfo(local_file, remote_file)
    else:
        sftp.put(local_file, remote_file)
