def sync(filename, connection=None):
    """Syncs a file

    :param filename: File to check out
    :type filename: str
    :param connection: Connection object to use
    :type connection: :py:class:`Connection`
    """
    c = connection or connect()
    rev = c.ls(filename)
    if rev:
        rev[0].sync()