<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_alias(path):
 """ Get a path alias for a single path Returns a tuple of (url,is_permanent) """

    # pylint:disable=too-many-return-statements

    record = model.PathAlias.get(path=path)

    if not record:
        return None, None

    template = record.template if record.template != 'index' else None

    if record.entry and record.entry.visible:
        if record.template:
            # a template was requested, so we go to the category page
            category = (record.category.category
                        if record.category else record.entry.category)
            return url_for('category',
                           start=record.entry.id,
                           template=template,
                           category=category), True

        from . import entry  # pylint:disable=cyclic-import
        outbound = entry.Entry(record.entry).get('Redirect-To')
        if outbound:
            # The entry has a Redirect-To (soft redirect) header
            return outbound, False

        return url_for('entry',
                       entry_id=record.entry.id,
                       category=record.entry.category,
                       slug_text=record.entry.slug_text), True

    if record.category:
        return url_for('category',
                       category=record.category.category,
                       template=template), True

    if record.url:
        # This is an outbound URL that might be changed by the user, so
        # we don't do a 301 Permanently moved
        return record.url, False

    return None, None