def shorten_to_63_chars(string):
    """
    Trims the middle out of a string until it's <= 63 characters.
    
    Useful because postgres limits column names to 63 chars.
    """

    string = str(string)
    if len(string) > 63:
        out =  '%s...%s'%(string[:30], string[-30:])
        print(out)
        return out
    return string