import json


def transform_password(value):
    """
    Transform a password hash into an object that specifies the type of hashing
    algorithm used. This allows password hashes from legacy systems to be
    loaded on a per-record basis.
    """
    if not value:
        return None

    try:
        formated_json = json.loads(value)
    except ValueError:
        return value
    return formated_json