def sftp_prefix(config):
    """
    Generate SFTP URL prefix
    """
    login_str = ''
    port_str = ''

    if config['username'] and config['password']:
        login_str = '%s:%s@' % (config['username'], config['password'])
    elif config['username']:
        login_str = '%s@' % config['username']

    if config['port'] and config['port'] != 22:
        port_str = ':%d' % config['port']

    return 'sftp://%s%s%s/' % (login_str, config['host'], port_str)