Given a target_reference, made in context of 'project',
    returns the AbstractTarget instance that is referred to, as well
    as properties explicitly specified for this reference.

def resolve_reference(target_reference, project):
    """ Given a target_reference, made in context of 'project',
    returns the AbstractTarget instance that is referred to, as well
    as properties explicitly specified for this reference.
    """
    # Separate target name from properties override
    assert isinstance(target_reference, basestring)
    assert isinstance(project, ProjectTarget)
    split = _re_separate_target_from_properties.match (target_reference)
    if not split:
        raise BaseException ("Invalid reference: '%s'" % target_reference)

    id = split.group (1)

    sproperties = []

    if split.group (3):
        sproperties = property.create_from_strings(feature.split(split.group(3)))
        sproperties = feature.expand_composites(sproperties)

    # Find the target
    target = project.find (id)

    return (target, property_set.create(sproperties))