def makeBuildAbandoned(blogNo):
    """Function specifically for fully populating the database from all recovered blogs."""
    blogId, url, lastUpdate, posts = pullBlogFilter(blogNo)
    if blogId:
        fn, ln, gn = nameGenerate()
        profile = Profile(
            fname = fn,
            lname = ln,
            gender = gn,
            age = ageGenerate(),
            location = locationGenerate(),
            species = Species.abandoned,
            blog_id = blogId,
            blog_url = url,
            last_login = lastUpdate
        )
        profile.position = profile.id
        assignImages(profile)
        for post in posts:
            newPost = Post(
                post_profile=profile,
                date_published=post[1],
                post_content=re.sub('<[^<]+?>', '', post[2])
            )
            newPost.save()
        return profile
    return None
def makeProfile(speciesType):
    """Creates and returns a new Profile object of provided speciesType.
    
    This will generate first name, last name, gender, age, and location and create
    a new Profile object. If the Profile is of species type 'abandoned' it will be
    populated with the data from a particular recovered blog from the reserves.
    
    If the Profile is of a different (active) species type it will swap positions
    with a pre-existing Profile object, be set to visible = False, given an initial
    energy value and have a Post created in honor of its birth.
    """
    fn, ln, gn = nameGenerate()
    profile = Profile(
        fname = fn,
        lname = ln,
        gender = gn,
        age = ageGenerate(),
        location = locationGenerate(),
        species = speciesType
    )
    assignImages(profile) #contains a profile.save()
    if speciesType == Species.abandoned:
        profile.blog_id, profile.blog_url, profile.last_login = makePosts(profile)
        profile.position = profile.id
        profile.save()
    else:
        swapPosition(profile, Profile.objects.all().order_by('?')[0])
        profile.last_login = timezone.now()
        profile.visible = False
        profile.energy = System.energy
        profile.save()
        makeBirthPost(profile)
    return profile