@classmethod<EOL><INDENT>def from_str(cls, human_readable_str, decimal=False, bits=False):<DEDENT>
divisor = <NUM_LIT:1000> if decimal else <NUM_LIT><EOL>num = []<EOL>c = "<STR_LIT>"<EOL>for c in human_readable_str:<EOL><INDENT>if c not in cls.digits:<EOL><INDENT>break<EOL><DEDENT>num.append(c)<EOL><DEDENT>num = "<STR_LIT>".join(num)<EOL>try:<EOL><INDENT>num = int(num)<EOL><DEDENT>except ValueError:<EOL><INDENT>num = float(num)<EOL><DEDENT>if bits:<EOL><INDENT>num /= <NUM_LIT:8><EOL><DEDENT>return cls(round(num * divisor ** cls.key[c.lower()]))<EOL>
attempt to parse a size in bytes from a human-readable string.